P15 - C

++
61 A “has a” relationship between classes represents
_________ and an “is a” relationship
between classes represent _______.
Association,Inheritance
Containment,Inheritance
Polymorhism,Inheritance
Inheritance,Containment
62 A _______ is a set of instance or al!es.
Class
"tr!ct!re
#b$ect
All of aboe
6% &ame man'lin' is done by the _________.
C(( Compiler
)in*er
)oader
&one of these
6+ new operator allocates memory bloc*s from the _______.
stac*
,emp memory
-eap
.oth 1/ +
%% 0ember f!nctions of a class are normally made
________ and data members of a class are
normally made ________. 1p!blic, priate2
Priate,Protected
P!blic,Priate
Priate,Priate
P!blic,Protected
%+ Inheritance enables _______ which saes time in
deelopment , and enco!ra'es !sin'
preio!sly proen and hi'h 3!ality software.
4ncaps!lation
5ast"peed
both 1 / +
6e!sability
%7 A “has a” relationship between classes represents
_________ and an “is a” relationship
between classes represent _______.
Association,Inheritance
Containment,Inheritance
Polymorhism,Inheritance
Inheritance,Containment
%6 A _______ is a set of instance or al!es.
Class
"tr!ct!re
#b$ect
All of aboe
61 A _________ is a special member f!nction !sed to
initiali8e the data members of a class.
9estr!ctor
Constr!ctor
#b$ect
&one
111 In C(( one can 'et the memory addresses of ariables
and f!nctions.
,r!e
5alse
1+% :hen an e;ception if throw, b!t not ca!'ht, the pro'ram
i'norers the error.
,r!e
5alse
1++ A class ob$ect passed to a f!nction template m!st
oerload any operators !sed on the class
ob$ect by the template.
,r!e
5alse
1+7 In the f!nction template definition it is not necessary to
!se each type parameter declared in
the template prefi;.
,r!e
5alse
1+6 It is possible to oerload a f!nction template and an
ordinary 1non<template2 f!nction.
,r!e
5alse
1+= A class template may not be !sed as a base class.
,r!e
5alse
1+> :hen declarin' an iterator from the ",), the compiler
a!tomatically creates the ri'ht *ind,
dependin' !pon the container it is !sed with.
,r!e
5alse
1+? @iosA stream is deried from iostream.
,r!e
5alse
17B @eof12A f!nction ret!rns 8ero al!e if the eofbit is set.
,r!e
5alse
21 9ata items in a class may be p!blic.
,r!e
5alse
7B A n!ll pointer is a pointer that contains
the address B
the address that points to B
the address that points to @CBA
the address that points to <1
71 :hat is the o!tp!t of the followin' codeD
Eincl!deFiostream.hG
oid main12
H
int arrIJI%JKHB,11,22,%%,++,77LM
int Na K /arrIBJIBJM
co!tFFarrI1JI2JFFO OFFN1a(%2M
L
77 %%
Compile ,ime error
%% 77
6!ntime 4rror
72 :hat is the o!tp!t of the followin' codeD
Eincl!deFiostream.hG
oid main12
H
int arrI2JI%JI2JKHHH2,+L,H=,>L,H%,+L,L, HH2,2L,H2,%L,
H%,+L, LLM
co!tFF1N1N1Narr(12(22(B2(=M
L
1B
%
'arba'e al!e
error
7% :hat is the o!tp!t of the followin' codeD
Eincl!deFiostream.hG
oid main12
H
int arrI2JI%JI2JKHHH2,+L,H=,>L,H%,+L,L, HH2,2L,H2,%L,
H%,+L, LLM
co!tFFNN1Narr(12(2(=M
L
16
=
11
4rror
7+ ,he desi'n of classes in a way that hides the details of
implementation from the !ser is *nown
asP
4ncaps!lation
Information -idin'
9ata abstraction
All of the aboe
77 :hich of the followin' *eywords do yo! thin* can be
!sed when declarin' static members in a
classD
1i2 P!blic
1ii2 Priate
1iii2 Protected
i, ii and iii
i and ii.
#nly i.
i and iii.
76 I want a nonmember f!nction to hae access to the
priate members of a class. ,he class m!st
declare that f!nctionP
friend
inline
static
irt!al
7= :hat do yo! thin* is the o!tcome of callin' a redefined
non<irt!al f!nction !sin' a base<class
pointerD
,he appropriate redefined ersion of the f!nction will be !sed.
,he base<class ersion of the f!nction will always be !sed.
,he o!tcome is !npredictable.
A r!n<time error will occ!r.
7> A _________ is a special member f!nction !sed to
initiali8e the data members of a class.
9estr!ctor
Constr!ctor
#b$ect
Class
7? ,he defa!lt access for members of a class is _________.
Priate
Protected
P!blic
&one
6B Inheritance enables _______ which saes time in
deelopment , and enco!ra'es !sin'
preio!sly proen and hi'h 3!ality software.
4ncaps!lation
5ast"peed
6e!asability
.oth 1 / +

Sign up to vote on this title
UsefulNot useful