oops mcq.doc

Embed Size (px)

Citation preview

  • 8/9/2019 oops mcq.doc

    1/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 !ption B

    ". #ow many instances of an a$stract class can $e created?

    A.1 B.% C.1& D.'

    Answer !ption D

    &.(ultiple inheritance means)

    *a+ one class inheriting from more super classes

    *$+ more classes inheriting from one super class

    *c+ more classes inheriting from more super classes

    *d+ ,one of the a$o-e

    *e+ *a+ and *$+ a$o-e.

    Answer *a+

    4.n o$/ect oriented programming new classes can $e defined $y e0tending e0isting classes. his is

    e0ample of

    *a+ *a+2ncapsulation *$+ nterface

    *c+ *c+Composition *d+ nheritance *e+ Aggregation.

    Answer *d+

    %.he wrapping up of data and functions into a single unit is called

    *a+ 2ncapsulation *$+ A$straction

    *c+ Data #iding *d+ Polymorphism *e+ (essage passing.

    Answer *a+

  • 8/9/2019 oops mcq.doc

    2/6

    3.which of the following are legal identifiers in /a-a

    *i+ "4 *ii+ temp5 *iii+ Class *i-+ data6 *-+ rue

    *a+.*ii+ and *i-+ only

    *$+.*ii+)*i-+ and *-+ only

    *c+ *ii+)*iii+ and *i-+ only

    *d+ *ii+)*iii+)*i-+ and *-+ only

    Answer a

    7. A class is a mechanism to

    *a+. create user defined data types

    *$+.encapsulate data and code together 

    *c+.create and $uild o$/ects

    *d+.All of the a$o-e

    Answer d

    8.n order to e0ecute) a /a-a program is

    *a+.only compiled

    *$+.only interpreted

    *c+.$oth compiled and interpreted

    *d+.neither compiled and interpreted

    answer c

    9. what will $e the output of the following code segment

      a:1';

      $:9;

    system.out.println*a

  • 8/9/2019 oops mcq.doc

    3/6

    1'. in /a-a) the type =char> is

      *a+ unsigned 13$it *$+ signed 13$it *c+ unsigned 8$it *d+ signed 8$it

    Answer $

    11.Assume fi-e o$/ects are created for a class;each o$/ect has its own copy of 

      *a+ data mem$ers only *$+ mem$er functions only

      *c+ data mem$ers and mem$er functions $oth *d+ none of the a$o-e

    Answer a

    1".n /a-a) >new > operator is used to create

    *a+ only primiti-e types *$+ only o$/ects

    *c+ $oth primiti-e types and o$/ects *d+ ,one of the a$o-e

    Answer c

    1&.in /a-a) gar$age collection can $e done done $y

      *a+ only manually $y user *$+ automatically $y /a-a runtime

      *c+ $oth manually and automatically *d+ ,one of the a$o-e

    Answer $

    C@@

    16. o e0pose a data mem$er to the program) you must declare the data mem$er in the

    section of the class

    A. common B. e0posed

    C. pu$lic D. unrestricted

    2. user  

    Answer C

  • 8/9/2019 oops mcq.doc

    4/6

    1%. 

    o $e called o$/ectoriented) a programming language must allow

    *A+. functions that return only a single -alue

    *B+. include files

    *C+. inheritance

    *D+. All of the a$o-e

    Answer !ption C

    13. A function that returns no -alues to the program that calls it is  

    *A+. not allowed in C@@ *B+. type -oid

    *C+. type empty *D+. type $arren

    Answer !ption B

    17.When a child class function is called) the compiler loos first for a matching function name in

    the  

    *A+. class of the o$/ect using the function name

    *B+. immediate ancestor class

    *C+. $ase class

    *D+. descendant class

    Answer !ption A

    18. 

    A function that is called automatically each time an o$/ect is destroyed is a

    *A+. constructor *B+. destructor  

    *C+. destroyer *D+. terminator  

    Answer !ption B

    19. 

    he type to $e used in an instantiation of a class template follows  

    A. the generic class name B. the eyword template

    C. the eyword class D. the template definition

    Answer !ption A

  • 8/9/2019 oops mcq.doc

    5/6

    "'. 

    What does C@@ append to the end of a string literal constant?

    A. a space B. a num$er sign *+

    C. an asteris *+ D. a null character  

    Answer !ption D

    "1. 

    !-erloaded functions are reEuired to

    A. ha-e the same return type B. ha-e the same num$er of parameters

    C. perform the same $asic functions D. ,one of the a$o-e

    Answer !ption D

    "". A widget is to the $lueprint for a widget as an o$/ect is to

    A. a mem$er function B. a class

    C. an operator D. a data item

    Answer !ption B

    "&. 

    A $ase class may also $e called a

    A. child class B. su$class

    C. deri-ed class D. parent class

    Answer !ption D

    "6.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

  • 8/9/2019 oops mcq.doc

    6/6

    "%. 

    When you pass a -aria$le ) C@@ passes only the contents of the -aria$le to the

    recei-ing function

    A. $y reference B. $y -alue

    C. glo$ally D. locally

    Answer !ption B