Programming :: All Aptitude Test ::

Hassan
1.Which of the following statement is correct about the program given below?
A. The program will print the output 11 12.
B. The program will print the output 12 11.
C. The program will print the output 12 13.
D. The program will print the output 11 12.

2.Which of the following statement is correct about the program given below?
A. The program will print the output 25 49.
B. It will result in a compile time error.
C. The program will print the output 50 50.
D. The program will print the output 25 49.

3.Which of the following statement is correct about the program given below?
A. It will result in a compile time error.
B. The program will print the output 1.
C. The program will print the output 2.
D. It will result in a compile time error.

4.A constructor that accepts parameters is called the default constructor?
A. one
B. two
C. three
D. one

5.What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
A. Compile-time error.
B. Preprocessing error.
C. Runtime error.
D. Compile-time error.

6.Can a class have virtual destructor?
A. Yes
B. No
C. Both
D. Yes

7.Destructor has the same name as the constructor and it is preceded by?
A. !
B. ?
C. ~
D. !

8.For automatic objects, constructors and destructors are called each time the objects?
A. enter and leave scope
B. inherit parent class
C. are constructed
D. enter and leave scope

9.What will be the output of the program?
A. 99.50
B. Garbage value
C. ASCII value of 99
D. 99.50

10.Which of the following statement is correct about the program given below?
A. The program will print the output Pak
B. The program will print the output Mcqs
C. The program will print the output PakMcqs
D. The program will print the output Pak

11.Which of the following statement is correct about the program given below?
A. The program will print the output 25.
B. The program will print the output Garbage-value.
C. The program will report compile time error.
D. The program will print the output 25.

12.Which of the following statement is correct about the program given below?
A. The program will print the output 5.
B. The program will print the output Garbage-value.
C. The program will report compile time error.
D. The program will print the output 5.

13.What will be the output of the program ?
A. 1234
B. 4321
C. 12344321
D. 1234

14.Which of the following function prototype is perfectly acceptable?
A. int Function(int Tmp = Show());
B. float Function(int Tmp = Show(int, float));
C. Both A and B.
D. int Function(int Tmp = Show());

15.Which of the following statement is correct?
A. C++ enables to define functions that take constants as an argument.
B. We cannot change the argument of the function that that are declared as constant.
C. Both A and B.
D. C++ enables to define functions that take constants as an argument.

16.Which of the following statement is correct?
A. Overloaded functions can have at most one default argument.
B. An overloaded function cannot have default argument.
C. All arguments of an overloaded function can be default.
D. Overloaded functions can have at most one default argument.

17.Which of the following statement will be correct if the function has three arguments passed to it?
A. The trailing argument will be the default argument.
B. The first argument will be the default argument.
C. The middle argument will be the default argument.
D. The trailing argument will be the default argument.

18.What will be the output of the program?
A. 237
B. 242
C. 240
D. 237

19.What will be the output of the following program?
A. -6
B. -8
C. 6
D. -6

20.What will be the output of the program?
A. a = 20 b = 40
B. a = 20 b = 30
C. a = 20 b = Garbage
D. a = 20 b = 40

21.What will be the output of the program?
A. The program will print the output 10 20.
B. The program will print the output 10 0.
C. The program will print the output 10 garbage.
D. The program will print the output 10 20.

22.What will be the output of the program?
A. 20
B. 30
C. 40
D. 20

23.What happens when we try to compile the class definition in following code snippet?
A. It will not compile because class body of Birds is not defined.
B. It will not compile because class body of Peacock is not defined.
C. It will not compile because a class cannot be protectedly inherited from other class.
D. It will not compile because class body of Birds is not defined.

24.Which of the following statements is incorrect?
A. Friend keyword can be used in the class to allow access to another class.
B. Friend keyword can be used for a function in the public section of a class.
C. Friend keyword can be used for a function in the private section of a class.
D. Friend keyword can be used in the class to allow access to another class.

25.Which of the following statement is correct regarding destructor of base class?
A. Destructor of base class should always be static.
B. Destructor of base class should always be virtual.
C. Destructor of base class should not be virtual.
D. Destructor of base class should always be static.

26.Which of the following two entities (reading from Left to Right) can be connected by the dot operator?
A. A class member and a class object.
B. A class object and a class.
C. A class and a member of that class.
D. A class member and a class object.

27.How can we make a class abstract?
A. By making all member functions constant.
B. By making at least one member function as pure virtual function.
C. By declaring it abstract using the static keyword.
D. By making all member functions constant.

28.What will be the output of the program?
A. 10 10 20 20
B. Garbage garbage 20 20
C. 10 10 Garbage garbage
D. 10 10 20 20

29.Which of the following statement is correct about the program given below?
A. The program will print the output 0.
B. The program will print the output 33.
C. The program will print the output Garbage.
D. The program will print the output 0.

30.Which of the following statement is correct about the program given below?
A. The program will print the output 0.
B. The program will print the output 44.
C. The program will print the output Garbage.
D. The program will print the output 0.


Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers