1.What will the following statement output?
cout << &num1;
A)None of these
B)the value stored in the variable named num1
C)the number 1
D)the memory address of the variable named num1
E)the string &num1
2. What will the following code output?
int number = 888;
int *var = &number;
cout << var << endl;
A)the address of number
B)an asterisk followed by 8888
C)8888
D)an asterisk followed by the address of number
3. Assuming ptr is a pointer variable, what will the following
statement output?
cout << *ptr;
A) the address of the variable stored in ptr
B)the address of the variable whose address is stored in ptr
c)None of these
D)the value stored in the variable whose address is contained in ptr
E) the string "*ptr"
4. If you declare a pointer and a variable like this:
int a = 1;
int *aPtr = &a;
To dereference aPtr, you would use the * operator.
A)True
B) False
1. D)the memory address of the variable named num1 2. A)the address of number 3. D)the value stored in the variable whose address is contained in ptr 4. To dereference aPtr, you would use the * operator. A)True
1.What will the following statement output? cout << &num1; A)None of these B)the value stored in...
Question 27 The following statement ________. cin >> *num3; stores the keyboard input in the variable num3 stores the keyboard input into the pointer num3 is illegal in C++ stores the keyboard input into the variable pointed to by num3 None of these Question 28 The following statement ________. int *ptr = new int; results in a compiler error assigns an integer less than 32767 to the variable ptr assigns an address to the variable ptr creates a new pointer...
. C++ 11.A statement that displays the address of the variable num1 is Question 11 options: a) cout << &num1; b) cout << *num1; c) cout << num1; d) cout << &(*num1); 12.The statement int *ptr = new int; acquires memory to hold an integer and then Question 12 options: a) sets ptr to point to the allocated memory. b) assigns an integer value to the variable called ptr. c) initializes the allocated memory to 0. d) creates a new...
TRUE/FALSE 1. If pl is an integer pointer variable, with the value of 1000, pl++ changes P1 to point to the memory location 1001. ANSWER: T 2. When you return a dynamic array to the freestore, you must include the number of elements in the array 3. You can assign an array to a pointer variable. 4. The size of dynamic arrays must be declared at compile time. 5. int *pl; declares a static variable. ANSWER: F ANSWER: F ANSWER:...
51. What is the output of the following code snippet? int number = 0; int ptr_num -&number ptr_num 60; number-80 cout < "ptr num << endl b, 60 c. 80 d. the address of number Answer 52. What is the output of the following code snippet? double num-0.0; double* ptr = # num = 15.0; ptr ptr 15.0 cout << num <<"ptr <<endl; a. 15 15 b. 15 30 С. 30 15 d. 30 30 Answer: 53. What is the...
c++ questions need help QUESTION 1 Given the following code, what is the value of *ptr? int var = 5; int *ptr = &var; int *myptr = ptr; *ptr = -8; var = 0; *myptr = 2; a. 2 b. -8 c. 5 d. 0 QUESTION 2 Given the following code, what is the value of ptr+1? int arr[3] = {0, 0, 0}; int *ptr = arr; *ptr = 8; a. 9 b. undefined c. the address of arr[0] d....
c++ question 1. C++ string Class What does the output look like after executing the following statements? std::string numstr = "12"; numstr += "3"; std::cout << numstr << '\n'; A. None of these. B. The snippet has syntax errors. C. 15 D.123 // 2. Let S be a class that allows integers to be stored in its objects like an array. For example, if obj is an object of S, one can write statements like obj[0] = 100; or int...
Note: None of these functions should use cout. It is OK to use cout while debugging to check how your function is working, but your final submission should not contain cout in any function but main. Head ==== Name the source file for this section head.cpp. Write a function named "head" which takes an array of integers as an argument, and returns the first element in the array. Write a function named main which outputs the result of testing your...
34) Which of the following arithmetic operations is allowed on pointer variables? a. Modulus b. Multiplication c. Increment d. Division 35) In a two-dimensional array, the elements are arranged in a table form. True False 36) In C++, which is the proper use of the indirection operator. int *ptr int &ptr int ptr[] None of the above 37) The statement int list[25]; declares list to be an array of 26 components, since the array index starts at 0. True False...
What is the output of the following? int x = 50, y = 60, z = 70; int* ptr; ptr = &x; *ptr += 10; ptr = &y; *ptr += 5; ptr = &z; *ptr -= 3; cout << x << “ ” << y << “ ” << z << endl; A) 10 5 2 B) 50 60 70 C) 60 65 67 D) 60 65 72
plz solve 2 ,4,8,10
" << endl; acement display? Ans: answer= B. answer 2. cu int x = 2, y = 1; what will the following cout statement display? Ans: cout << "answer=" < (x || !y ) << endl; A. answer=0 B. answer=1 C. answer=2 D. None of these This code void ActivateBuzzer(int); is c A. to call a function B. function definition (C.)function declaration D. not valid Which option correctly describes the result of the following C/C++ code?...