0% found this document useful (0 votes)
53 views10 pages

Multiple Choice Questions: Eecs 183 Winter 2014 Exam 1

1. The document provides instructions for an exam, including turning off cell phones, bringing one notecard, and bubbling in personal information on the scantron form. 2. It asks the test taker to sign below and print their name, acknowledging they will not cheat or receive outside help on the exam. 3. The remainder of the document contains 20 multiple choice questions testing C++ programming knowledge.

Uploaded by

Mrsymphony
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views10 pages

Multiple Choice Questions: Eecs 183 Winter 2014 Exam 1

1. The document provides instructions for an exam, including turning off cell phones, bringing one notecard, and bubbling in personal information on the scantron form. 2. It asks the test taker to sign below and print their name, acknowledging they will not cheat or receive outside help on the exam. 3. The remainder of the document contains 20 multiple choice questions testing C++ programming knowledge.

Uploaded by

Mrsymphony
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1

!!"# %&' ()*+,- ./%0 !123 %




Closeu Book Closeu Notes Closeu Electionic Bevices Closeu Neighboi

Tuin off Youi Cell Phones
We will confiscate all electionic uevices that we see - incluuing cell phones,
calculatois, etc.

456+)76, "89):, ;5,<+)9*<
=./ >5,<+)9*< ? @ 79)*+< 7,- >5,<+)9* A %// 79)*+<B


C,D %

E*<+-5:+)9*<F G,2H "2-,I566DJ
1. 0ne hanuwiitten S" x S" notecaiu alloweu.
2. Some questions aie not simple, theiefoie, ieau caiefully.
S. Assume all coue anu coue fiagments aie syntactically valiu, unless otheiwise specifieu.
4. Assumeuse only the stanuaiu C++11.
SK E* 266 +8, L)M,* :9H,N )I 2*D :82-2:+,- 699O< 6)O, 2 <72:,N )+ )< 9*,K

6. 0n the scantion sheet, bubble in youi *23, anu P4EQ RR %/ 7+< 9II I9- )*:9--,:+ P4EQ.
7. 0n the scantion sheet, bubble in C,D % RR S,-9 9* ,123 )I O,D *9+ T5TT6,H )*.
8. Sign below anu piint youi uniqname -- %/ 7+< 9II )I U, :2**9+ -,2H D95- 5*)>*23,

! #$%& '&()#&* +(%&' ',* *&-&(%&. $(. ,' )#(/ &0$1('$)(,'2 ',* #$%& !
-,'-&$3&. $'4 %(,3$)(,'/ ,5 )#& 6,',* 7,.&8




_________________________________________________________________________________________________________
Sign youi name above Piint youi uniqname, LEuIBLY
2

(Intentionally left blank such that you may use if neeueu)
















































3



1 What uoes the following expiession evaluate to.

! # $ % $

A) 0
B) $
C) !
D) &'() '* +,) -.'/)



2 Which of the following evaluates to an ouu numbei.

01 $ % 2 # 3 # 3
41 2 % $ # 3 # 3
51 2 # 3 # $ % 3
61 2 # $ % $ # 3
71 &'() '* +,) -.'/)



3 Which of the following coue fiagments will assign the numbei 89! to vaiiable :.

01 ;'<.=) : > 39? @ ! A 3B
41 ;'<.=) : > 3 @ ! # 3B
51 ;'<.=) : > 39? @ ! # 3B
61 ;'<.=) : > 39? @ C9? % ! # 3B
71 ;'<.=) : > 39? @ ! # C9? % 3B



4 What uoes the expiession C3$8 # C? # C? A C? evaluate to.

01 C
41 3
51 $
61 8
E) None of the above








4

5 If the usei types! #$% & '$% ()*+),-. what uoes the following coue snippet output.

;'<.=) D > $B
E(+ : > 3B
F,-G F, > H2HB
FE( II D II F, II :B
F'<+ JJ D % :B

A) !9!
B) 2
C) K
D) K9!
E) None of the above


6 If the usei types! #$% & '$% ()*+),-. what uoes the following coue snippet output.
(Note: this is a uiffeient question than the one above -- ieally it is -- ieau closely)

;'<.=) D > $B
E(+ : > 3B
F,-G F, > H2HB
FE( II : II D II F,B
F'<+ JJ D % :B

A) ?
B) C
C) 3
D) 39!
E) None of the above



7 If the usei types: /0 123) ()*+),-, what uoes the following coue snippet output.

4+,5*6 L+GB
M)+=E()NFE(O L+G1B
F'<+ JJ L+GB


A) P'
B) 4=<)
C) P
D) P' 4=<)
E) None of the above




5

8 Consiuei the following function:
.''= EL5'G'(-+E'(6-:NE(+ (<Q1 R
E* N(<Q A C?? >> ?1 R
E* N(<Q A 8?? >> ?1 R
G)+<G( +G<)B
S )=L) R
G)+<G( *-=L)B
S
S )=L) E* N(<Q A 8 >> ?1 R
G)+<G( +G<)B
S )=L) R
G)+<G( *-=L)B
S
S
Which of the following test suites thoioughly test the above function by testing eveiy path
thiough the function.

A) CTTTO 3???O 3??C
B) CUTTO CT??O CT?CO CT?3
C) CU??O 3???O 3??U
D) CT??O CT$?O CT2?O 3???



9 What uoes the following line of coue piint.

F'<+ JJ VWV##X'Q) Y)'Y=) -G) #VB##VZ'G+, Q)=+E(M *'G [[ \=-*VB

A) W
B) V
C) V##X'Q) Y)'Y=) -G) #
D) &'() '* +,) -.'/)
E) 5'QYE=-+E'( 7GG'G



10 Consiuei the following C++ function:

E(+ '-])(NE(+ D1 R
G)+<G( D @ CB
S

What uoes the expiession '-])(N'-])(N$11 evaluate to.

A) $
B) 8
C) !
D) 2
6

11 What uoes the following coue piint.

^E(F=<;) JE'L+G)-QI
<LE(M (-Q)LY-F) L+;B

E(+ ]GEL+'**NE(+ D1B
E(+ -((-NE(+ D1B

E(+ Q-E(N1 R
F'<+ JJ ]GEL+'**NC1 @ -((-N31B
G)+<G( ?B
S

E(+ ]GEL+'**NE(+ D1 R
@@DB
G)+<G( -((-ND1B
S

E(+ -((-NE(+ D1 R
D > D @ 3B
G)+<G( DB
S

A) !
B) 2
C) K
D) U
E) T



12 Which of the following calls to the function *G'_)( aie valiu (i.e., will
compile), if *G'_)( has the function piototype:

/'E; *G'_)(NE(+ DO F,-G :1B

01 *G'_)(NCO H%H1B
41 F'<+ JJ *G'_)(NCO H%H1B
51 E(+ D > *G'_)(NC?O H%H1 @ $B
61 0== '* +,) -.'/)
71 0 -(; 4







7

13 What uoes the following C++ piogiam piint.

^E(F=<;) JE'L+G)-QI
<LE(M (-Q)LY-F) L+;B

/'E; '=-*NE(+ DO E(+ :1B

E(+ Q-E(N1 R
E(+ D > CB
E(+ : > $B
'=-*NDO :1B
F'<+ JJ D JJ VO V JJ :B
G)+<G( ?B
S

/'E; '=-*NE(+ DO E(+ :1 R
E(+ +)QY > DB
D > :B
: > +)QYB
G)+<G(B
S


01 CO C
41 CO $
51 $O C
61 $O $



14 What uoes the following coue fiagment piint if the usei
enteis: 7% 8#()*+),-

E(+ +)QY)G-+<G)O -Q'<(+B
FE( II +)QY)G-+<G) II -Q'<(+B

E* N+)QY)G-+<G) I ?1 R
E* N-Q'<(+ I> C?1 R
F'<+ JJ V4<E=; Q) - *GE)(;V JJ )(;=B
S )=L) R
F'<+ JJ V\, ('` a+HL +'' F'=; +' L('ZV JJ )(;=B
S
S

A) 4<E=; Q) - *GE)(;
B) \, ('` a+HL +'' F'=; +' L('Z
C) &'() '* +,) -.'/)

8



15 What uoes the following C++ piogiam piint.

^E(F=<;) JE'L+G)-QI
<LE(M (-Q)LY-F) L+;B

E(+ Q-E(N1 R
E(+ D > 83B
E* ND I> ?1 R
F'<+ JJ Va ;'(H+ ,-/) - L]<==9 \G .'()L9VB
S )=L) E* ND J> 831 R
F'<+ JJ VaHQ \=-* -(; a =E]) Z-GQ ,<ML9VB
S )=L) R
F'<+ JJ Va+HL L' F<+)9 bE]) =E++=) .-.: <(EF'G(VB
S
G)+<G( ?B
F'<+ JJ V\,O =''] -+ +,-+9 aH/) .))( EQY-=);9VB
S

A) a ;'(H+ ,-/) - L]<==9 \G .'()L9
B) aHQ \=-* -(; a =E]) Z-GQ ,<ML9
C) a+HL L' F<+)9 bE]) =E++=) .-.: <(EF'G(
61 \,O =''] -+ +,-+9 aH/) .))( EQY-=);9
E) It will iun with no eiiois, but piint nothing.





16 Consiuei the following function Q-GL,Q-=='Z:

E(+ Q-GL,Q-=='ZN.''= YO .''= c1 R
E(+ D > ?B
E(+ : > 3B

G)+<G( NND I C1 dd Y1 ee NN: J $1 dd c1B
S

What uoes the function Q-GL,Q-=='Z ietuin.
01 ?
41 C
51 f,) G)+<G( /-=<) ;)Y)(;L '( +,) /-=<)L '* .'+, Y -(; c
61 f,) G)+<G( /-=<) ;)Y)(;L '( +,) /-=<) '* Y .<+ ('+ c
71 f,) G)+<G( /-=<) ;)Y)(;L '( +,) /-=<) '* c .<+ ('+ Y



9



17 What uoes the following coue snippet piint.

E(+ D > CB
Z,E=) ND J !1 R
D %> D @ CB
S
F'<+ JJ D JJ V V JJ )(;=B

A) C
B) !
C) 2
D) C 3 2
E) 3 2




18 uiven the following function implementation, what uoes 932:;<%= ietuin.

E(+ .<=;-NE(+ (1 R
E(+ E > ?B
Z,E=) NE J (1 R
E > E @ CB
( > ( @ CB
S
G)+<G( EB
S

01 8
41 !
51 2
61 4),-/E'G EL <(;)*E(); [[ Q-: 'G Q-: ('+ L+'Y














10


19 If the usei types #> ?> > @> ()*+),- what uoes the following coue piint.

E(+ DB
E(+ L/)( > ?B

FE( II DB
Z,E=) ND I ?1 R
E* ND I L/)(1 R
L/)( > DB
S
FE( II DB
S
F'<+ JJ L/)( B

01 3?
41 2?
51 ?
61 K?


20 Which of the following is a :9376,3,*+ of the C++ expiession
N+)QY)G-+<G) J C? dd +)QY)G-+<G) I U?1.

A) N+)QY)G-+<G) I C? ee +)QY)G-+<G) J U?1
B) NC? J> +)QY)G-+<G) J> U?1
C) NC? J> +)QY)G-+<G) ee +)QY)G-+<G) J> U?1
D) N+)QY)G-+<G) I> C? dd +)QY)G-+<G) J> U?1
E) &'() '* +,) -.'/)

You might also like