Explore topic-wise MCQs in Computer Science Engineering (CSE).

This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Engineering (CSE) knowledge and support exam preparation. Choose a topic below to get started.

1.

Predict the output of following C++ program#include using namespace std;class Empty {}; int main(){cout <

A. a non zero value
B. 0
C. compile time error
D. runtime error
Answer» B. 0
2.

class Test { int x;};int main(){Test t; cout <

A. 0
B. garbage value
C. compile time error
Answer» D.
3.

Which of the following statements is correct for a static member function?1. It can access only other static members of its class. It can be called using the class name, instead of objects

A. only 1 is correct
B. only 2 is correct
C. both 1 and 2 are correct
D. both 1 and 2 are incorrect
Answer» D. both 1 and 2 are incorrect
4.

Which of the following is true about the following program#include class Test{public:int i;void get();};void Test::get(){std::cout <<"Enter the value of i: "; std::cin >>i;}Test t; // Global object int main(){Test t; // local object t.get();std::cout <<"value of i in local t: "<

A. compiler error: cannot have two objects with same class name
B. compiler error in line "::t.get();"
C. compiles and runs fine
Answer» D.
5.

Predict the output?#include using namespace std;class Test{int x;Test() { x = 5;}};int main(){Test *t = new Test; cout <x;}

A. compile time error
B. garbage
C. 0
D. 5
Answer» B. garbage
6.

Is it fine to call delete twice for a pointer?#include using namespace std;int main(){int *ptr = new int; delete ptr;delete ptr; return 0;}

A. yes
B. no
Answer» C.
7.

What will be the output of following program?#include using namespace std;class Test{public:Test() { cout <<"Hello from Test() "; }} a;int main(){cout <<"Main Started "; return 0;}

A. main started
B. main started hello from test()
C. hello from test() main started
D. compiler error: global objects are not allowed
Answer» D. compiler error: global objects are not allowed
8.

Which of the following operators are overloaded by default by the compiler?1) Comparison Operator ( == )2) Assignment Operator ( = )

A. both 1 and 2
B. only 1
C. only 2
D. none of the two
Answer» D. none of the two
9.

Which of the following is true about constructors. They cannot be virtual. They cannot be private. They are automatically called by new operator

A. all 1, 2, and 3
B. only 1 and 3
C. only 1 and 2
D. only 2 and 3
Answer» C. only 1 and 2
10.

In C++, const qualifier can be applied to Member functions of a class Function arguments To a class data member which is declared as static Reference variables

A. only 1, 2 and 3
B. only 1, 2 and 4
C. all
D. only 1, 3 and 4
Answer» D. only 1, 3 and 4
11.

What will be the values of x, m and n after execution of the following statements? Int x, m, n; m=10; n=15; x= ++m + n++;

A. x=25, m=10, n=15
B. x=27, m=10, n=15
C. x=26, m=11, n=16
D. x=27, m=11, n=16
Answer» D. x=27, m=11, n=16
12.

#include using namespace std;int main(){int a;a = 5 + 3 * 5;cout <

A. 35
B. 20
C. 25
D. 30
Answer» C. 25
13.

#include using namespace std; class Point {public:Point() { cout <<"Constructor called"; }};int main(){Point t1, *t2; return 0;}

A. compiler error
B. constructor called constructor called
C. constructor called
Answer» D.
14.

#include using namespace std;class X{public:int x;};int main(){X a = {10};X b = a;cout <

A. compiler error
B. 10 followed by garbage value
C. 10 10
D. 10 0
Answer» E.
15.

Output of following program?#include using namespace std; class Point {Point() { cout <<"Constructor called"; }};int main(){Point t1; return 0;}

A. compile time error
B. run time error
C. constructor called
Answer» B. run time error