Você está na página 1de 10

Objective Questions:-

1. C++ language was invented by

(a) Bjarne Stroustrup

(b) Dennis Ritche

(c) Ken Thompson

(d) None of the above

2. Composition of objects in a class is known as

(a) delegation

(b) inheritance

(c) polymorphism

(d) none of the above

3. The streams is a

(a) flow of data

(b) flow of integer

(c) flow of statements

(d) none of the above

4. The buffer is a

(a) block of memory

(b) part of ram

(c) part of hard disk

(d) none of the above

5. The gcount() function counts the

(a) extracted character

(b) inserted character

(c) both (a) and (b)

(d) none of the above

6. The new operator

(a) allocate memory


(b) releases memory

(c) both (a) and (b)

(d) none of the above

7. The loop statement terminates by a semi-colon is

(a) do-while loop

(b) for loop

(c) while loop

(d) none of the above

8. The constant function

(a) cannot alter value of a variable

(b) can alter value of a constant variable

(c) makes its local variable constant

(d) none of the above

9. The member of a class are by default

(a) Private

(b) Public

(c) Protected

(d) Friend

10.Encapsulation means

(a) protecting data

(b) allowing global access

(c) data hiding

(d) both (a) and (c)

11.Constructor is executed when

(a) object is declared

(b) object is destroyed

(c) both (a) and (b)

(d) none of the above


12.The keyword operator is used to overload an

(a) operator

(b) function

(c) class

(d) none of the above

13.A,B and C are objects of same class. To execute the statement C=A+B ,
the operator must be overloaded.

(a) +

(b) =

(c) both (a) and (b)

(d) none of the above

14.The operator function returns value of

(a) basic type

(b) void type

(c) class type

(d) all types

15.Identify the access specifier

(a) public

(b) virtual

(c) void

(d) class

16.The pointer holds

(a) address of the variable

(b) value of the variable

(c) both (a) and (b)

(d) none of the above

17.The size of void pointer is

(a) 0 byte

(b) 2 byte
(c) 4 byte

(d) 8 byte

18.The array name itself is a

(a) pointer

(b) reference

(c) variable

(d) object

19.The dynamic objects are created

(a) at run-time

(b) compile time

(c) both (a) and (b)

(d) none of the above

20.In C++, it is possible to pass values to function by

(a) call by value

(b) call by address

(c) call by reference

(d) all of the above

21.Dynamic binding is done using the keyword

(a) Virtual

(b) Inline

(c) Static

(d) Void

22.When a base class is not used for object declaration it is called as

(a) abstract class

(b) container class

(c) concrete class

(d) derived class

23.The eof() stands for


(a) end of file

(b) error opening file

(c) error of file

(d) none of the above

24.The write() function writes

(a) single character

(b) objects

(c) string

(d) none of the above

25.Templates are suitable for

(a) any data type

(b) basic data type

(c) derived data type

(d) all of the above

26.Function template are normally defined

(a) in function main()

(b) globally

(c) anywhere

(d) in a class

27.Template class is also called as

(a) generic class

(b) container class

(c) virtual class

(d) base class

28.Exception is generated in

(a) try block

(b) catch block

(c) throw block


(d) none of the above

29.A and B are two string objects. A=”abc” and B=”xyz”. A=A+B will produce

(a) “abcxyz”

(b) “abc”

(c) “xyzabc”

(d) none of the above

30.We can access string characters using

(a) at() function

(b) subscript operator[]

(c) () operator

(d) None of the above

31.An algorithm is a process that

(a) processes the data

(b) stores the data

(c) sorts the data

(d) none of the above

32.An iterator is similar to

(a) pointer

(b) array

(c) class

(d) none of the above

33.The function object is similar to

(a) object

(b) variable

(c) both (a) and (b)

(d) none of the above

34.Which of the following keywords is not a part of ANSI C++?

(a) far
(b) public

(c) static

(d) none of the above

35.Size of enum data type is

(a) 1 bytes

(b) 2 bytes

(c) 4 bytes

(d) 8 bytes

36.Range of unsigned char is

(a) -128 to 127

(b) 0 to 255

(c) 0 to 65535

(d) None of the above

37.The member of struct are by default

(a) private

(b) public protected

(c) none of the above

38.The : : is known as

(a) scope access operator

(b) double colon

(c) both (a) and (b)

(d) none of the above

39.The packing of data and function into a single component is known as

(a) encapsulation

(b) polymorphism

(c) abstraction

(d) none of the above

40.The operator function returns value of


(a) basic type

(b) void type

(c) class type

(d) all type

Subjective Question:-

1. (a) Explain the key concepts of OOP. Define advantages and


disadvantages of OOP. Describe different parts of C++ programs.

(b) What is inline () function? Define Characteristics of inline () function


and explain in what case inline () function is not used.

2. (a) Write a program to create a class complex which accepts real and
imaginary data member ,all constructor() ,destructor() and + operator
overloading function to add two objects and returns the sum as object.

(b) Define the difference between static binding and dynamic binding with
suitable example

3. (a) What is virtual function? Distinguish between virtual function and pure
virtual function with suitable example.

(b) What is dynamic initialization? Define run – time polymorphism with


suitable example.

4. (a) What is static binding ? Distinguish between dynamic binding and late
binding.

(b) What is inheritance? Explain hierarchical inheritance with example.

5. (a) Write is virtual base class with suitable example ? Describe the
advantages of this class over inheritance.

(b) Write a program to create a class that have a number and recursive
prime() function to check whether the given data member is prime or not.

6. (a) Write a program to create base class that have two integer data
members but not constructor() function designed and derived class that have a
single data member and constructor() function which uses base class data in its
constructor and sum() function to computer the sum of three numbers .

(b) Why runtime exception need not be caught or specified? Give three
examples of runtime exception. What are the uses of stream class?
7. (a) Write a program to create a class that has a member function which
is friend function of another class with suitable example.

(b) What is stream? Define input stream and output stream hierarchy.

8. (a) What are the friend functions and friend classes? What are different
between object and variable?

(b) What are the uses of random access file over sequential access file
with example?

9. (a) What are type modifiers? Write a program to draw a square box .Use
for loop.

9. (b) Write a program which reads in names and phone numbers from a file
and outputs them in a nice order with a nice format. Your program should ask
the user to specify a file. if the file does not exist, the program should warn the
user and end. if the file does exit, the output is in nice format .

10. (a) What are static member variables and functions? Write a
program to count numbers between 1 to 100, which are not divisible by 2, 3 and

10. (B) Write a program that would create a set of student records and
stores into the file. The program should allow the user to add records of
new students or delete record if the student leaves the college. It should
also display all the records in ascending order of the student roll numbers.

11. (a) Write a program to call constructor . Calculate factorial of a given


number.

(b) What is virtual destructor? How do they differ from normal constructor?

Can constructors be declared as virtual constructor? Give reason.

12. (a) Write a program to create a class employee that contains name, roll
and address, dynamic constructor and dynamic destructor to add or
remove records dynamically.

(b) Write a program to create array of string. Read and display the strings
using constructor and destructor.

13. (a) What are constant objects ? How they are declared?

(b) Write a program to create object without name.

14 (a) what is new and delete operator? Use it with the two matrices
addition program.

(b) Write a program to overload < operator and display the smallest
number out of two objects.

15(a) what is the difference between operators overloading and function


overloading?
(b) Explain the various method of performing formatted stream I/O
operation.

16 (a) Write a program to declare matrix class and perform addition of matrix
class objects.

(b) Write a program to define three classes A,B and C. Each class contains
private data members. Derive class C from A and B by applying multiple
inheritances. Read and display the data using constructors and
destructors.

17 (a) Describe the use of public, private, and protected access specifies.

(b What is constructor overloading ? Explain it with example.

18 (a) ) What are the advantages and disadvantages of inheritance?

(b) Explain hierarchical inheritance.

19

(a) What is file? What are steps involved in manipulating a file in a C++
program.

(b) Explain the various file stream classes need for file manipulations ?

20 (a) Write a program to define virtual, non-virtual functions and determine


size of the objects.

(b) What is data hiding? What are different mechanism for protecting data
from the external users of class’s objects? .

Você também pode gostar