You are on page 1of 6

1. Which of the following is not a type of constructor?

A.

Copy constructor

B.

Friend constructor

C.

Default constructor

D.

Parameterized constructor

Answer: Option B
2. How many instances of an abstract class can be created?
A.1

B.5

C.13

D.0

Answer: Option D
3.Multiple inheritance means,
(a) one class inheriting from more super classes
(b) more classes inheriting from one super class
(c) more classes inheriting from more super classes
(d) None of the above
(e) (a) and (b) above.
Answer : (a)
4.

In object oriented programming new classes can be defined by extending existing classes.
example of:

(a) (a)Encapsulation

(b) Interface

(c) (c)Composition

(d) Inheritance

(e) Aggregation.

Answer : (d)
5.The wrapping up of data and functions into a single unit is called
(a) Encapsulation

(b) Abstraction

(c) Data Hiding

(d) Polymorphism

Answer : (a)

(e) Message passing.

This is an

6.which of the following are legal identifiers in java


(i) 2S (ii) temp$ (iii) Class (iv) data4 (v) True
(a).(ii) and (iv) only
(b).(ii),(iv) and (v) only
(c) (ii),(iii) and (iv) only
(d) (ii),(iii),(iv) and (v) only
Answer : a
7. A class is a mechanism to
(a). create user defined data types
(b).encapsulate data and code together
(c).create and build objects
(d).All of the above
Answer : d
8.In order to execute, a java program is
(a).only compiled
(b).only interpreted
(c).both compiled and interpreted
(d).neither compiled and interpreted
answer : c
9. what will be the output of the following code segment :
a=10;
b=9;
system.out.println(a<b);
(a).True
answer : b

(b).False

(c).0

(d).1

10. in java, the type char is


(a) unsigned 16-bit

(b) signed 16-bit

(c) unsigned 8-bit

(d) signed 8-bit

Answer : b
11.Assume five objects are created for a class;each object has its own copy of
(a) data members only

(b) member functions only

(c) data members and member functions both

(d) none of the above

Answer : a
12.In java, new operator is used to create
(a) only primitive types

(b) only objects

(c) both primitive types and objects

(d) None of the above

Answer : c
13.in java, garbage collection can be done done by
(a) only manually by user

(b) automatically by java runtime

(c) both manually and automatically

(d) None of the above

Answer : b
C++
14. To expose a data member to the program, you must declare the data member in the _____
section of the class
A.

common

B.

exposed

C.

public

D.

unrestricted

E.

user

Answer : C

15. To be called object-oriented, a programming language must allow


(A).

functions that return only a single value

(B).

#include files

(C).

inheritance

(D).

All of the above

Answer: Option C
16. A function that returns no values to the program that calls it is _____
(A).

not allowed in C++

(B).

type void

(C).

type empty

(D).

type barren

Answer: Option B
17.When a child class function is called, the compiler looks first for a matching function name in
the _____
(A).

class of the object using the function name

(B).

immediate ancestor class

(C).

base class

(D).

descendant class

Answer: Option A
18. A function that is called automatically each time an object is destroyed is a
(A).

constructor

(B).

destructor

(C).

destroyer

(D).

terminator

Answer: Option B
19. The type to be used in an instantiation of a class template follows ________
A.

the generic class name

B.

the keyword template

C.

the keyword class

D.

the template definition

Answer: Option A

20. What does C++ append to the end of a string literal constant?
A.

a space

B.

a number sign (#)

C.

an asterisk (*)

D.

a null character

Answer: Option D
21. Overloaded functions are required to
A.

have the same return type

B.

have the same number of parameters

C.

perform the same basic functions

D.

None of the above

Answer: Option D
22. A widget is to the blueprint for a widget as an object is to
A.

a member function

B.

a class

C.

an operator

D.

a data item

Answer: Option B
23. A base class may also be called a
A.

child class

B.

subclass

C.

derived class

D.

parent class

Answer: Option D
24.The step-by-step instructions that solve a problem are called _____
A.

an algorithm

B.

a list

C.

a plan

D.

a sequential structure

Answer: Option A

25. When you pass a variable _____, C++ passes only the contents of the variable to the
receiving function
A.

by reference

B.

by value

C.

globally

D.

locally

Answer: Option B

You might also like