Introduction To C Plus Plus - Study Mode
[#96] What is the correct way to declare a pointer in C++?
Correct Answer
(C) int* ptr
[#97] What is the output of the following code: int x = 10
cout << "Value of x is: " << x++ << endl
?
Correct Answer
(D) Value of x is: 10
[#98] What is the correct syntax to dynamically allocate memory for an array of integers in C++?
Correct Answer
(C) int *arr = new int[size]
[#99] What will be the output of the following C++ code? #include<iostream>
using namespace std
int x[100]
int main()
{
cout << x[99] << endl
}
Correct Answer
(B) 0
[#100] What will be the output of the following C++ code? #include <iostream>
using namespace std
class A
{
private:
int x
public:
A(int _x) { x = _x
}
int get() { return x
}
}
class B
{
static A a
public:
static int get()
{ return a.get()
}
}
int main(void)
{
B b
cout << b.get()
return 0
}
Correct Answer
(B) Compile-time Error