Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int arr[] = {4, 5, 6, 7}; int *p = (arr + 1); cout << *arr + 9; return 0; }
Q2
When does the void pointer can be dereferenced?
Q3
Which one of the following is not a possible state for a pointer.
Q4
Which value can we not assign to reference?
Q5
A void pointer cannot point to which of these?
Q6
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int a = 5; int *p = &a; int &q = p; cout<<p; return 0; }
Q7
What will be the output of the following C++ code? #include <iostream> using namespace std; int f(int &x, int c) { c = c - 1; if (c == 0) return 1; x = x + 1; return f(x, c) * x; } int main(int argc, char const *argv[]) { int a = 4; cout<<f(a,a); return 0; }
Q8
What will be the output of the following C++ code? #include<iostream> using namespace std; int &fun() { static int x = 10; return x; } int main() { fun() = 30; cout << fun(); return 0; }
Q9
Which of the following is incorrect?
Q10
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int &p; int a = 5; &p = a; cout<<p; return 0; }
Q11
What will happen in the following C++ code snippet? int a = 100, b = 200; int *p = &a, *q = &b; p = q;
Q12
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int *p; void *vp; if (vp == p) cout << "equal"; return 0; }
Q13
What is the meaning of the following declaration? int(*p[5])();
Q14
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int a = 5; int *p = &a; int *(&q) = p; cout<<q; return 0; }
Q15
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { char arr[20]; int i; for(i = 0; i < 10; i++) *(arr + i) = 65 + i; *(arr + i) = '\0'; cout << arr; return(0); }
Q16
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int &q = 5; cout<<q; return 0; }
Q17
What will be the output of the following C++ code? #include <iostream> using namespace std; #define PI 3.14159 int main () { float r = 2; float circle; circle = 2 * PI * r; cout << circle; return 0; }
Q18
Identify the correct sentence regarding inequality between reference and pointer.
Q19
Which of the following is illegal?
Q20
The constants are also called as . . . . . . . .
Q21
What are the parts of the literal constants?
Q22
What is the difference between references and pointers?
Q23
The operator used for dereferencing or indirection is . . . . . . . .
Q24
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char const *argv[]) { int &q = NULL; cout<<q; return 0; }
Q25
Which reference modifier is used to define the reference variable?