Assume num1 has been declared as an int, and ch has been declared as a char. Each of the following answers should be one line of code:
Q: Task: Convert the character in AL to upper case.
A: GIVEN: Convert the character in AI to uppercase.
Q: If the variable letter has been defined as a char variable, which of the following are not valid…
A: If the variable letter has been defined as a char variable, which of the following are not valid…
Q: Examine the following code to find out what is the last value store in the variable K. INOU are…
A: We need to find the output of variable K at the end of the program execution successfully.
Q: String Val1 = "1234"; 4321; Int Val2 String Val3; Val3 Val1 + Val2;
A: In the above codes, val1 is a string type variable and val2 is an int type variable. Although val3…
Q: QUESTION 13 If you attempt to add an int, a byte, a long, and a double, the result will be a O int O…
A: Given data types are int, byte, long, double order of data types storing small values to large…
Q: Assume c is a char variable. What value does c hold after each of the following statements…
A: Answer: The functions toupper() and tolower() are in-built function in c++. The function toupper()…
Q: Which XXX is valid for the following code? int CalcSum(int a, int b) { return a + b; } int main() {…
A: Function must be called in order to execute the statements defined inside the function. The actual…
Q: What are the advantages of using named constants? Declare a SIZE int constant with the value 20.
A: Named constants are identifiers that have the same value throughout the programme. During the…
Q: Suppose that num is an int variable and discard is a char variable. Assume the following input…
A: a) code: #include <iostream> using namespace std; int main() { int num; char discard; cout…
Q: QUESTION 8 You can cast a character value to an int, or an int to char. O true O false QUESTION 9…
A: Question 8 Int to character can be casted using various methods and character to int can be casted…
Q: Which of the following is a valid declaration for phone number? А. int phoneNumber; В. char…
A: Given:
Q: What value does the following code print out? #include int main() { double result; double…
A: The output value is 0.5
Q: What will the result of len variable after execution of the following statements? int len; char *str…
A: The statements are given by: int len; char *str="39 march road"; len=strlen(str1); After…
Q: Suppose that num is an int variable and discard is a char variable. Assume the following input data:…
A: The method cin.get(character) will read a single character value from the console input window and…
Q: Question 23 1.5 pts Which one of the following values could not appear in the result of the cout…
A: The value printing is (i+rand()%i) The possible values of i are 6,5, and 4. since the for loop is…
Q: Note: The result should be identified whether it is int or float. 3.0 / 15.0 + 3 * 2 a. 5 % 3 * 6 /…
A: We can implement the given equations in python program Program import math a=3.0/15.0+3*2 print("a.…
Q: Given the following code segment, what will be the value of the variable "Val" after executing the…
A: The indexOf() method returns the position of the first occurrence of specified character(s) in a…
Q: 4) What is returned if factorial(3) is called? a) 0 b) 1 c) 3 d) 6
A: answer: 6 Explanation: factorial can be calculated by product from 1 to n in this case 1*2*3=6 so…
Q: If value is an identifier of int type and is holding value 200, is the following statement correct?…
A: introductoin:Int datatype is used in holding values:
Q: 3. Write a code that takes two float numbers from the user and then print the sum of these 2…
A: As there is no programming language mentioned so the question is attempted in c language.
Q: What is wrong in the following code? int total = 0, num = 0; do{// Read the next datacout <<…
A: Given:- What is wrong in the following code? int total = 0, num = 0; do{// Read the next datacout…
Q: Assume result is an int variable. When the following statement executes, what value will be stored…
A: Execution of statement The given statement is result = (2 + 5) * 10; The result…
Q: What value does the following code print out? #include int main() { int result; int firstInt = 10;…
A: Solution: The above C++ program code print the value 3. In the main function it take the three…
Q: Given the following code segment, what will be the value of the variable "Val" after executing the…
A: In the given question A/B result in floating point values however it is initialized to integer data…
Q: The purpose of (int) in the statement: int x = (int)(Math.log(16)); is to ……………………
A: Answer: The purpose of (int) in the statement: int x = (int)(Math.log(16)); is to int x = (int)…
Q: Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 1…
A: #include <iostream>using namespace std;int main() {int userNum1;int userNum2;cin >>…
Q: Examine the following code to find out what is the last value store in the variable K. //You are…
A: Dear Student, Hear the last value stored in variable K will be that of Sin(K) , as we are passing K…
Q: 1. Which is not an "unsignod" value of int type? A. 35 B.I C.-57 D.O E 124 2. Which statement about…
A:
Q: QUESTION 14 Local variables are not automatically initialized. O True O False
A: Hey there, I am authorised to answer any one question at a time when there are multiple questions…
Q: Find errors in the following lines of code assuming included header files. Write correct form with…
A: syntax errors: The programming language has a convention to follow the rules of the programming…
Q: 4. ů What is the value of result after the following code executes? int a = 60; int b = 15; int…
A: In the given code, there are three integers that are a, b and result. The value of a is 60, b is 15…
Q: Write at least one difference between int vs integer
A: Integer is a class, while "int" is a primitive. A int is a data type that stores 32 bit signed…
Q: Complete the function below: bool eligible(int marks){ I/returns true if marks is >85 else return…
A: Write a function in C++ which takes an integer marks as input parameter and return a bool true or…
Q: int Vall = 8; int Val2 = Vall; Vall = 9;
A: The value of Val1 after first statement is 8.
Q: What will be the value of result after the following code is executed? #include int fun (x) return…
A: Language is one of the most widely used programming language which has been used to create different…
Q: Time left 0:4 Assume the following declarations: char name [21]; char yourName [21]; char…
A: Valid statements are://cin>>name;//bool x=strcmp(yourName,studentName);…
Q: Refer to the following code. Which line may be used to complete the code so it would not result to…
A: This question comes from Python Programming Language which is a paper of computer science. Let's…
Q: Assuming the char data type uses 1 byte of memory, how many bytes do each of the following literals…
A: Given: Assuming the char data type uses 1 byte of memory, how many bytes do each of the…
Q: 1- Enter two values ( x and y) then print the square root value of (x) when (x-y)<10 otherwise print…
A: NOTE: As per our guidelines we are supposed to answer only one question so please post the another…
Q: Individual Arguments is reference arguments that are in consecutive order True O False O
A: Answer: True
Q: Explain the code #include int main() char A[5]; gets(A); puts(A); return o;
A: To find right option for the code.
Q: What will the value of the answer variable be after the code segment below has been run. int answer…
A: The answer is an integer variable which is not initialized. The other integer variables - number3,…
Q: What is the final value of the variablenum given the following code fragment? int row - 10; int col…
A: Answer: The correct answer to the given question is-"51".
Q: The following program or program segment has errors. Find as many as you can. char numeric[5]; int x…
A: The following program or program segment has errors. Find as many as you can. char numeric[5]; int x…
Q: value of sum after executing the following cod
A: I have run the code output is given as follows as i>4 it never enters into the loop for iteration…
Q: In which memory segments are the variables in the following code located? int i = 0; void…
A: We have a memory layout like below
Q: The following function has errors. Locate as many errors as you can. void total(int value1, value2,…
A: GIVEN: The following function has errors. Locate as many errors as you can. void total(int value1,…
Q: The following code will display 10: int a = 10; int *b = &a; cout << *b++; Select one: O True O…
A: a is initially storing value 10 b is pointing to the address of a
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- (a) Determine whether the following variable declaration is valid int INT; A Valid B Invalid (b) Determine whether the following variable declaration is valid. int *ptr; A Valid B Invalid (c) Which of the following statement about pointer is TRUE? A. A pointer variable is a variable used tostore an address B.A pointer holds the data, rather thanwhere to find the data C.The unary operator & is used to find anobject's value D.The unary operator * is used to find an object's addressQuestion 15 please Q11. Provide the output for the given C++ code about pointers. #include <iostream>using namespace std;int main(){char *ptr;char Str[] = "abcdefg";ptr = Str;ptr += 5;cout << ptr;return 0;} Q12. Provide the output for the given C++ code about arrays. #include <stdio.h>#include<iostream>using namespace std;int array1[] = {1200, 200, 2300, 1230, 1543};int array2[] = {12, 14, 16, 18, 20};int temp, result = 0;int main(){for (temp = 0; temp < 5; temp++){result += array1[temp];}for (temp = 0; temp < 4; temp++){result += array2[temp];}cout << result;return 0;} Q13. Provide the output for the given C++ code about arrays. #include <stdio.h>#include<iostream>using namespace std;int main (){int array[] = {0, 2, 4, 6, 7, 5, 3};int n, result = 0;for (n = 0; n < 8; n++){result += array[n];}cout << result;return 0;} Q14. Provide the output for the given C++ code about arrays. #include <stdio.h>#include…Explaining the importance of the concept of pointer, show how to obtain the address and value of a variable named deg that holds the value 5 in the int data type by using a pointer.
- There's this house I want to buy just right around the corner. I know its address but I don't know its value. Can you please help me determine it? Instructions: In the code editor, you are provided with an initial code which has main() function. In the main(), the user is asked for an integer input and then its address is assigned to a pointer variable (see line 10) Your task is to print the value of the pointer variable using the dereferencing operator.Assume aa is a pointer of int type, and has been allocated enough memory : int* aa = new int; Which line assign value 10 by using dereference and then release the memory correctly? Question 19 options: A. aa = 10; delete aa*; B. *aa = 10; delete aa; C. *aa = 10 delete []aa; D. aa = 10; delete [] aa;Address of Array//Write the output of each cout statement.//Assume the size of ints to be 4 bytes.//Assume the size of pointers to ints to be 8 bytes.int main() {int a[3][3]={{1,2,3},{4,5,6},{7,8,9}};cout << sizeof(a) << endl: //1: ___________________________cout << sizeof(a+0) << endl: //2: _____________________________cout << sizeof(*(a+0)) << endl: //3: _____________________________cout << sizeof(**a) << endl; //4: ____________________________cout << sizeof(&a) << endl; //5: _____________________________Assume the address of "a" is 0x7ffee2fef9e0cout << a + 1 << endl; //6: ________________________________________cout << *a + 1 << endl; //7: ________________________________________cout << **a + 1 << endl; //8: _______________________________________cout << &a << endl; //9: __________________________________________cout << &a + 1 << endl; //10:…
- Which function does not return the pointer correctly?The code below calls the getline member function of cin to read a line of characters from cin into an array of characters up to a certain limit specified as the second parameter of the call.Your job is to find out if the pointer returned from the function can still be used by the caller of the function to access the memory that is pointed to by the pointer.char *getName() { char buf[80]; cout << "Enter your name: "; cin.getline(buf, 80); return buf;}char *getName() { char buf[80]; cout << "Enter your name: "; cin.getline(buf, 80); return buf;}char *getName() { char *buf = new char[80]; cout << "Enter your name: ";cin.getline(buf, 80); return buf;}None of thesechar getName(char buf, int size) { **cout << "Enter your name: ";cin.getline(buf, size);return buf;}Create a function that can accept a pointers and array with values of 1000, 2, 3, 17, 50. Your program will display the array values and its averageThe following code C++ uses pointers and produces two lines of output. What is the output? int v1 = 10; int v2 = 25; int* p1 = &v1; int* p2 = &v2; *p1 += *p2; p2 = p1; *p2 = *p1 + *p2; cout << v1 << " " << v2 << endl; cout << *p1 << " " << *p2 << endl; find line 1 and 2.
- 1. Write a function called void swap with two parameters, which will receive the addressof x and y as pointer. The function should swap the value of x and y only if x is larger thany. Print the value of x and y after the function call. 2. Write a function called double getAverage(int *array, int SIZE), whereit accept the array as pointer, and return the average of the array. Print the returnedvalue from this function. Always use *array rather than subscript to access the arrayvalue.(define (add-one x) (+ x 1)) Add the following lines in the above statements and give the result. (define another-add-one add-one) (another-add-one 5) At the pointer level, what is happening here? Draw a picture in the answer box indicating what is happening.This lab will exercise your understanding of some of the concepts covered in Chapter 14: pointers and linked lists 1. Declare an integer pointer variable intPointer. Initialize it to point to an int variable named someInt. Assign the value 451 to someInt and output (cout) the variable someInt and output (cout) the value pointed to by intPointer. Write an assignment statement that indirectly stores 900 into the value pointed to by intPointer. Output (cout) the value pointed to by intPointer and output (cout) the variable someInt, 2. Declare a pointer variable charArrPointer and initialize it to point to the first element of a three-element char array named initials. Write assignment statements to store 'A', 'E', and 'W' into the first three elements of the array POINTED to by charArrPointer. Do NOT store any values directly into the array named initials. 3. Output (cout) the data in array charArrPointer and the data in array initials. 4. Copy the following code into your program above…