test-i-oop prog

26
Test-I:OOP Marks : 25 Time : 50 (Every question has an allotted time of 2 mins)

Upload: dhrubajyoti

Post on 12-Jan-2016

15 views

Category:

Documents


0 download

DESCRIPTION

object oriented programing

TRANSCRIPT

Page 1: Test-I-oop prog

Test-I:OOP

Marks : 25 Time : 50(Every question has an allotted time of 2 mins)

Page 2: Test-I-oop prog

Q1 (1 minute)

Q1. The process of building new classes f om existing one is called ______.

(A)Polymorphism (B) Structure (C) Inheritance (D)Cascading (E) Parallism

Page 3: Test-I-oop prog

Q2 (2minutes)

Q2. What is "polymorphism"?A. When a given stimulus produces a unique response

depending on the type of object stimulatedB. When a unique stimulus produces a common response for

all objects stimulatedC. When the compiler determines the unique response to a

stimulus, based on the type of the object stimulatedD. When the user determines a given response to a stimulus,

by selecting the type of object which is stimulatedE. When a T-1000 terminator morphs itself into a giant parrot

Page 4: Test-I-oop prog

Q3 (one and half minute)

Q3. Run Time Polymorphism is achieved by ______

(A) Static binding & Overriding(B) Late binding & Overriding(C) Static binding & Overloading(D) Late binding & Overloading(E) None of them

Page 5: Test-I-oop prog

Q4 (One and half minute)

Q4. Compile Time Polymorphism is achieved by ______

(A) Static binding & Overriding(B) Late binding & Overriding(C) Static binding & Overloading(D) Late binding & Overloading(E) None of them

Page 6: Test-I-oop prog

Q5 (1 minute)

Q5. The final results of a program is the state of the computer memory in

A. Imperative programmingB. Logic programmingC. Object oriented programmingD. Functional programmingE. None of the above

Page 7: Test-I-oop prog

Q5 ( one and half minute)

Q 5 Why is function overloading useful?A. It conserves identifiersB. It allows us to give related functions a common (and

logical) nameC. It allows us to pass the same arguments to different

functionsD. It reduces the total number of functions, therefore

improving program performanceE. It increases the total number of functions, therefore

improving program flexibility

Page 8: Test-I-oop prog

Q7 (one and half minute)

Q7. "Abstraction" is...A. Being distracted by your thoughtsB. The classification of objects, grouped according to

their significant similaritiesC. The classification of objects, grouped according to

their significant differencesD. The classification of objects, grouped according to

their namesE. Hiding information inside a class so that it can only

be known in an abstract manner.

Page 9: Test-I-oop prog

Q8 (one and half minute)

Q8 Why is abstraction important in the real world?A. Because it gives us a means of reducing complexity to a

manageable degree.B. Because the most important things (love, honour, justice)

are all abstractC. Because it is one of the foundations of the object-

oriented model.D. Because it allows us to ignore essential features of thingsE. Because it gives us a way of hiding information on a

"need-to-know" basis

Page 10: Test-I-oop prog

Q9 (one and half minute)

Q9. Why is abstraction important in programming?A. Because it gives us a means of reducing complexity to a

manageable degree.B. Because user-defined types are sometimes known as

"abstract data types"C. Because it is one of the foundations of the object-

oriented model.D. Because it allows us to ignore essential features of thingsE. Because it gives us a way of hiding data on a "need-to-

know" basis

Page 11: Test-I-oop prog

Q10 (One minute)

Q10. What is "encapsulation"?A. The division of a program into independent

modulesB. The enforcement of data hiding within a classC. The aggregation of data members within a classD. The aggregation of function members within a classE. Taking medication to help you program better

Page 12: Test-I-oop prog

Q11(one and half minute)

Q11. Which of the following are benefits of encapsulation?

A. Smaller executable and faster execution of code

B. Localizes effects and therefore errorsC. Prevents memory leaks and scope violationsD. Automatic error messagesE. None of the above

Page 13: Test-I-oop prog

Q12 (One and half minute)

Q12 Which of the following is a drawback of encapsulation?

A. Can't be used in non-OO programming languages.B. Data hiding must be checked and enforced at run-

time, so code may run slower.C. Data can only be accessed through specified

interface functions, so executable may be larger and run slower.

D. It prevents polymorphismE. None of the above

Page 14: Test-I-oop prog

Q13 (One and half minute)

Q13. How does encapsulation relate to abstraction?A. Encapsulation is a type of abstraction: abstraction of

privilegeB. Encapsulation is a type of abstraction: abstraction of

structureC. Encapsulation is a type of abstraction: abstraction of

functionD. Abstraction is a type of encapsulation: encapsulation

of conceptE. It doesn't. They are entirely separate concepts.

Page 15: Test-I-oop prog

Q14 (one and half minute)

Q14. The advantages of OOP are , 1. increased programming productivity 2. decreased maintenance costs. 3. less time to execute 4. easy to understand

A. 1& 3B. 1& 2C. 3& 4D. 2& 3E. All of 1,2,3 and 4

Page 16: Test-I-oop prog

Q15 (one minute)

Q15. When a program calls a function that has default parameters, if you omit an argument, you must____

A. not omit any other argumentsB. Omit all argumentsC. omit all arguments to the right of that argumentD. Omit all arguments to the left of that argument.E. None of these.

Page 17: Test-I-oop prog

Q16(One and half minute)

Q16 How does inheritance relate to abstraction?A. A base class is an abstraction of all its derived

classesB. A derived class is an abstraction of all its base

classesC. Base and derived classes are abstractions for each

otherD. Inheritance prevents abstractionE. There is no relationship between inheritance and

abstraction

Page 18: Test-I-oop prog

Q17 (One and half minute)

Q17. How does polymorphism relate to abstraction?A. Polymorphism is a mechanism for abstraction of

functionalityB. Polymorphism is a mechanism for abstraction of

structureC. Polymorphism is a mechanism for abstraction of

namingD. All forms of abstraction are polymorphicE. There is no relationship between polymorphism and

abstraction

Page 19: Test-I-oop prog

Q18 (one and half minute)

Q18 How does polymorphism relate to inheritance?A. Polymorphism relies on inheritance to ensure that derived

classes have the necessary capacity to receive a particular stimulus

B. Polymorphism relies on inheritance to ensure that no two classes respond identically to a particular stimulus

C. Polymorphism is the same as inheritance. The two concepts are identical

D. Polymorphism is the opposite of inheritance. The two concepts are mutually exclusive

E. There is no relationship between polymorphism and abstraction

Page 20: Test-I-oop prog

Q19 (one minute)

Q19. What is a "reference"?A. A synonym for "pointer"B. Another name for an objectC. Another name for a typeD. A way of copying objects without extra

memoryE. A name for any parameter to a C++ generic

type

Page 21: Test-I-oop prog

Q20 (one minute)

Q20. Which of the following statements declares a reference named refname?

A. ref refname = var&;B. int refname = &var;C. int& var = refname;D. int& refname = var;E. refname = int& var;

Page 22: Test-I-oop prog

Q21 (one and half minute)

Q21 What are the advantages of passing arguments by reference?

A. Changes to parameter values within the function also affect the original arguments.

B. There is need to copy parameter values (i.e. less memory used)

C. There is no need to call constructors for parameters (i.e. faster)

D. All of the aboveE. None of the above

Page 23: Test-I-oop prog

Q22 (one and half minute)

Q22. In what ways are references and pointers similar?

A. Both provide a mechanism for accessing some other piece of memory.

B. Same declaration syntax.C. Both must be dereferenced before use.D. Both are first class objects in C++.E. Both are always more compact (use less

memory) than the objects to which they refer (or point).

Page 24: Test-I-oop prog

Q23 (one and half minute)

Q23. How are classes related to the concept of abstraction?

A. Classes are the C++ mechanism for abstraction of functionality

B. Classes are the C++ mechanism for abstraction of structure

C. Classes are the C++ mechanism for abstraction of functionality and structure

D. Classes are an alternative to abstraction.E. Classes are an encapsulation mechanism and not

related to abstraction at all.

Page 25: Test-I-oop prog

Q24(one and half minute)

Q24. How are classes related to the concept of encapsulation?A. Classes provide an important alternative to encapsulation

in C++B. Classes provide an important mechanism for encapsulation

in C++C. Classes provide the only mechanism for encapsulation in

C++D. Classes encapsulate the object-oriented modelE. Classes are an abstraction mechanism and not related to

encapsulation at all.

Page 26: Test-I-oop prog

Q25 (one and half minute)

Q25 If you assign a default value to any variable in a function prototype’s parameter list, then _________

A. All other parameters in the function prototype must have default values.

B. All parameters to right of that variable must have default values

C. All parameters to the left of that must have default values

D. No other parameters in that prototype can have default values.

E. None of these