You are on page 1of 3

P24 C++

1 When the function passes a parameter by reference:


1) If the formal parameter changes ,the actual parameter also
changes
2) If the formal parameter changes , the actual parameter does
not change
3) If the actual parameter changes ,the formal parameter does
not change
4) If the actual parameter changes ,the formal parameter also
changes
a
b
c
d
2 Choose the correct one
1) Function return type may or may not be static array
2) static array can be pass by !alue
3) static array cannot br the target of an assignment
4) "i#e of a static array should be a compile time constant and
it cannot be resi#ed
a
b
c
d
3 this pointer could not be accessed from follo$ing
members
destructor
static function
!irtual function
friend function
4 Which member functions of a class cannot modify its
ob%ect attributes
1) Friend functions
2) &ri!ate member functions
3) Constant member functions
4) "tatic member functions
a
b
c
d
' (define is
1) )acro defination
2) File inclusion directi!es
3) Conditional compilation directi!es
4) Conditional e*pression operator
a
b
c
d
+ What is most appropriate, for getting success if condition
is ,a -- b)
1) a and b both can be false
2) a and b both can be true
3) a or b or both can be true
4) a or b or both can be false
a
b
c
d
. Which is false
1) Inheritance is deri!ing ne$ class from an e*isting class
2) In an inheritance , all data and function members of base
classs are deri!ed by deri!ed class
3) We can specify $hich data and function members of base
class $ill be inherited by deri!ed class
4) We can add ne$ functions to deri!ed class $ithout
recompiling the base class
a
b
c
d
/ !oid main, )
0
int 1 2 3*12 4 31445
cout 66 15
7
1) 3333
2) 1.2/
3) 1333
4) 1/33
a
b
c
d
8 !oid main , )
0
char % 2 l 5
$hile ,%62 2'') printf ,9:d;,%<<)5
7
1) l =>2''
2) ll the ascii char from l =>2''
3) Indefinite loop
4) l=>2'4
a
b
c
d
13 !oid main , )
0 for ,int i 2 1 5i<<5) cout 6i5
7
1) compilation error
2) 2 =>> 32.+.
3) indefinite loop
4) noneof the abo!e
a
b
c
d
11 ???????? data members re@uires t$o separate statements
for declaration and definition

1) static
2) global
3) auto
4) const
a
b
c
d
12 !oid main, )
0 int *,y,#5
* 2 y 2 # 2 A15
# 2 <<*--<<y--<<#5
cout 66*66 y66#5
7
1) B1A13
2) 3A13
3) 13A3
4) B13A1
a
b
c
d
13 !oid main , )
0
const int bC13D 2 013,23,33,43,'3,+3,.3,/3,83,13375
for, int i 2 35 i 613 5i<<)
bCiD <2 '5
cout 66bC'D5
7
1) '3
2) +'
3) +3+3+3+3+'+'+'+'+'
4) compilation error
a
b
c
d
14 !oid main, )
0
int aCD 2 0 13,23,33,43,'37, %, 4p5
for,p2a<4, %235 %624 5 %<<)
cout 66 4pC%D5
7
1) 13233343
2) '343332313
3) Error
4) 43332313
a
b
c
d
1' !oid main , )
0
static int aC3DC3D 2 01,2,3,4,',+,.,/,875
int 4pC3D 2 0 aC3D ,aC1D, aC2D75
int 44ptr 2 p5 int 15
for ,1 2 3 5 1 62 2 51<<)
cout 664pC1D5
7
1) 1'8
2) 14.
3) synat* error
4) 123
a
b
c
d
1+ Find the output
!oid main , ) 0 cout 66 31. 66 3*1. 6631>. 57
1) 1.1.1>.
2) 1.231>.
3) error
4) 1'231>.
a
b
c
d
1. cout66 31133311 < 133111335
1) 11111111
2) 1333+321
3) 3*FF
4) Compiller Fependent
a
b
c
d
1/ What is true about main , )
1) returns 3 implicitly
2) returns 1 implicitly
3) returns 1 e*plicitly
4) need not return anything
a
b
c
d
18 int I235
$hile, )
0
printf,9 : i 9, I<< )5
7
Endless Goop
Error
3
"tac1 H!erflo$
23 Choose most appropriate statement
1) n abstract base class can ha!e pure !irtual destructor
2) n abstract base class can ha!e only !irtual destructor
3) n abstract base class can ha!e non !irtual destructor
4) n abstract base class cannot ha!e destructor
a
b
c
d
21 What is the reality about friendship
1) Friendship is al$ays refle*i!e
2) Iransiti!e relationship holds true
3) Friendship is al$ays one$ay
4) Friendship can not be declared in public
a
b
c
d
22 What is correct about pure !irtual functionsJ
1) re present only in abstract base class
2) re e@uated to 3
3) Kas no code for that class
4) ll of these
a
b
c
d
23 If a base class member accesss is public , and an
inherited class accesss specifier is pri!ate , $hich of the
follo$ing statements is true J
1) Ihe base class members can be accessed by deri!ed class
ob%ects
2) Ihe base class members cannot be accessed by the dei!ed
class members
3) Ihe deri!ed class members can be accessed by the base
class ob%ects >
4) Ihe base class members can be accessed by the deri!ed
class a
b
c
d
24 goto*y ,*, y) is
1) function $hich ta1es cursor to *,y position
2) macro $hich ta1es cursor to *,y position
3) neither function nor a macro
4) member fiunction of ostream class
a
b
c
d
2' If the assert macro in!ocation results into a non #ero
result
1) &rogram terminates immediately
2) &rogram continues in normal fashion
3) &rogram gi!es standard error and then terminates
4) It does not result in any of the abo!e results
a
b
c
d
2+ main,)
0
printf,L:d:d:dL, si#eof,3>14f), si#eof,3>14), si#eof,3>14l))5
7
Consider
char 2 1 bytes
int 2 2 bytes
float 2 4 bytes
long 2 4 bytes
4 4 4
4 Marbage !alue Marbage Nalue
4 / 13
Error
2. t compile time
1) n ob%ect is bound of its function for member function call
2) n ob%ect is not bound to its function at compile time
3) n ob%ect is lin1ed to its function dynamically
4) Nirtual function calls are resol!ed
a
b
c
d
2/ What is used to teriminate a function
a) brea1
b) return
c) e*it
d) halt
a
b
c
d
28 !oid main , )
0
int i 2 35 const int -c 2 i5 int -1 2 i5
i 2' 5 c 2 13 5 1 2 235
cout 66 I 66 c 66 15
7
a) '''
b) '1323
c) 232323
d) error
a
b
c
d
33 Nariable of type Osigned floatP re@uires
a) 4 bytes
b) ' bytes
c) / bytes
d) none of the these
,ssme NC compiller)
a
b
c
d

You might also like