Discrete Structures :: All Aptitude Test ::

1.Why Java is Partially OOP language ?
A. It supports usual declaration of primitive data types
B. It doesn’t support all types of inheritance
C. It allows code to be written outside classes
D. It supports usual declaration of primitive data types

2.Which concept of OOP is false for C++ ?
A. Code can be written without using classes
B. Code must contain at least one class
C. A class must have member functions
D. Code can be written without using classes

3.Which header file is required in C++ to use OOP ?
A. iostream.h
B. stdio.h
C. stdlib.h
D. iostream.h

4.Which of the two features match each other ?
A. Inheritance and Encapsulation
B. Encapsulation and Polymorphism
C. Encapsulation and Abstraction
D. Inheritance and Encapsulation

5.Which feature allows open recursion, among the following ?
A. Use of this pointer
B. Use of pointers
C. Use of pass by value
D. Use of this pointer

6.Which is known as a generic class ?
A. Abstract class
B. Final class
C. Template class
D. Abstract class

7.Size of a class is ?
A. Sum of the size of all the variables declared inside the class
B. Sum of the size of all the variables along with inherited variables in the class
C. Size of the largest size of variable
D. Sum of the size of all the variables declared inside the class

8.Which class can have member functions without their implementation ?
A. Default class
B. String class
C. Template class
D. Default class

9.Which of the following describes a friend class ?
A. Friend class can access all the private members of the class, of which it is a friend
B. Friend class can only access protected members of the class, of which it is a friend
C. Friend class don’t have any implementation
D. Friend class can access all the private members of the class, of which it is a friend

10.What is the scope of a class nested inside another class ?
A. Protected scope
B. Private scope
C. Global scope
D. Protected scope

11.Which among the following is false, for member function of a class ?
A. All member functions must be defined
B. Member functions can be defined inside or outside the class body
C. Member functions need not be declared inside the class definition
D. All member functions must be defined

12.Which syntax for class definition is wrong ?
A. class student{ };
B. student class{ };
C. class student{ public: student(int a){ } };
D. class student{ };

13.Which of the following pairs are similar ?
A. Class and object
B. Class and structure
C. Structure and object
D. Class and object

14.Which among the following is false for class features ?
A. Classes may/may not have both data members and member functions
B. Class definition must be ended with a colon
C. Class can have only member functions with no data members
D. Classes may/may not have both data members and member functions

15.Instance of which type of class can’t be created ?
A. Anonymous class
B. Nested class
C. Parent class
D. Anonymous class

16.Which definition best describes an object ?
A. Instance of a class
B. Instance of itself
C. Child of a class
D. Instance of a class

17.How many objects can be declared of a specific class in a single program ?
A. 32768
B. 127
C. 1
D. 32768

18.Which among the following is false ?
A. Object must be created before using members of a class
B. Memory for an object is allocated only after its constructor is called
C. Objects can’t be passed by reference
D. Object must be created before using members of a class

19.Which of the following is incorrect ?
A. class student{ }s;
B. class student{ }; student s;
C. class student{ }s[];
D. class student{ }s;

20.The object can’t be ?
A. Passed by reference
B. Passed by value
C. Passed by copy
D. Passed by reference

21.What is size of the object of following class (64 bit system) ?
A. 20
B. 22
C. 24
D. 20

22.If a local class is defined in a function, which of the following is true for an object of that class ?
A. Object is accessible outside the function
B. Object can be declared inside any other function
C. Object can be used to call other class members
D. Object is accessible outside the function

23.Which among the following is wrong ?
A. class student{ }; student s;
B. abstract class student{ }; student s;
C. abstract class student{ }s[50000000];
D. class student{ }; student s;

24.Object declared in main() function ?
A. Can be used by any other function
B. Can be used by main() function of any other program
C. Can’t be used by any other function
D. Can be used by any other function

25. When an object is returned ?
A. A temporary object is created to return the value
B. The same object used in function is used to return the value
C. The Object can be returned without creation of temporary object
D. A temporary object is created to return the value

26.Which among the following is correct ?
A. class student{ }s1,s2; s1.student()=s2.student();
B. class student{ }s1; class topper{ }t1; s1=t1;
C. class student{ }s1,s2; s1=s2;
D. class student{ }s1,s2; s1.student()=s2.student();

27.Which among following is correct for initializing the class below ?
A. student s[3]={ s(394, 9); s(394, 9); s(394,9); };
B. student s[2]={ s(394,9), s(222,5) };
C. student s[2]={ s1(392,9), s2(222,5) };
D. student s[3]={ s(394, 9); s(394, 9); s(394,9); };

28.Which among the following doesn’t come under OOP concept ?
A. Platform independent
B. Data binding
C. Message passing
D. Platform independent

29.Which feature of OOP is indicated by the following code ?
A. Inheritance
B. Polymorphism
C. Inheritance and polymorphism
D. Inheritance

30.Which feature may be violated if we don’t use classes in a program ?
A. Inheritance can’t be implemented
B. Object must be used is violated
C. Encapsulation only is violated
D. Inheritance can’t be implemented


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