Question 1 of 25
Hints left: 3
Q1
What will be the output of the following C++ code? #include <iostream> using namespace std; class Point { int x, y; public: Point(int i = 0, int j =0) { x = i; y = j; } int getX() const { return x; } int getY() {return y;} }; int main() { const Point t; cout << t.getX() << " "; cout << t.gety(); return 0; }
Q2
What is the other name of compile-time polymorphism?
Q3
Which of the following is accessed by a member function of a class?
Q4
Which of the following is the correct difference between cin and scanf()?
Q5
Which of the following is C++ equivalent for scanf()?
Q6
What will be the output of the following C++ code? #include<iostream> using namespace std; int x[100]; int main() { cout << x[99] << endl; }
Q7
Which function is used to write a single character to console in C++?
Q8
What happens if the following program is executed in C and C++? #include <stdio.h> void func() { printf("Hello"); } void main() { func(); func(2); }
Q9
What is static binding?
Q10
Which of the following is correct in C++?
Q11
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; }
Q12
Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?
Q13
Which of the following is not a type of inheritance?
Q14
Which of the following operator(s) can be used with pointers? i. – only ii. +, * iii. +, – iv. +, -, * v. / vi. + only
Q15
What will be the output of the following C++ code? #include<iostream> using namespace std; int x = 1; int main() { int x = 2; { int x = 3; cout << ::x << endl; } return 0; }
Q16
Which of the following is correct about this pointer in C++?
Q17
What is the other name of run-time polymorphism?
Q18
Which of the following is correct?
Q19
Which of the following escape sequence represents tab?
Q20
What will be the output of the following C++ code? #include <iostream> using namespace std; class Test { static int x; public: Test() { x++; } static int getX() {return x;} }; int Test::x = 0; int main() { cout << Test::getX() << " "; Test t[5]; cout << Test::getX(); }
Q21
Which of the following type is provided by C++ but not C?
Q22
Which of the following is used for comments in C++?
Q23
What is the size of a character type in C and C++?
Q24
What happens if the following program is executed in C and C++? #include<stdio.h> int main() { foo(); } int foo() { printf("Hello"); return 0; }
Q25
Which of the following is an exit-controlled loop?