You are on page 1of 3

AMCAT

COMPUTER PROGRAMMING PRINCIPLES AND APPLICATIONS: Sample Questions All questions are Multiple-Choice-Questions with only one option as the correct answer. Q1. A !"it si#ne$ inte#e% &as t&e 'ollo(in# %an#e: a. 0 to 255 b. -128 to 127 c. -255 to 25 !. 0 to 50" Q). *&at (ill "e t&e output o' t&e 'ollo(in# +o$e statements,
integer x = 34.54, y = 20, z = -5 print ( y > 50 AND z > 10 or x > 30 )

a. 0 b. 1 c. -1 !. 10 Q-. Pan.a/ ma.es a p%o#%am to p%int t&e p%o$u+t o' +u"es o' t&e 'i%st 10 (&ole num"e%s. S&e (%ites t&e 'ollo(in# p%o#%am:
integer x = 0 // state ent 1 integer s! = 0 // state ent 2 "#i$e ( x % 10 ) // state ent 3 & s! = x'x'x // state ent 4 x = x ( 1 // state ent 5 ) print s! // state ent *

#s her pro$ra% correct& #' not( which state%ent will you %o!i'y to correct it& a. )o error( the pro$ra% is correct. b. *tate%ent 1 c. *tate%ent !. state%ent + Q1. I &a2e a p%o"lem to sol2e (&i+& ta.es as input a num"e% n. T&e p%o"lem &as a p%ope%t3 t&at #i2en t&e solution 'o% 4n!156 I +an easil3 sol2e t&e p%o"lem 'o% n. *&i+& p%o#%ammin# te+&ni7ue (ill I use to sol2e su+& a p%o"lem, a. #teration b. ,ecision-%a-in$ c. .b/ect .riente! 0ro$ra%%in$

!. 1ecursion Q8. Gi2en: inte#e% 9 : 106 3 : -86 ; : )06 ( : 10 Comment a"out t&e output o' t&e 'ollo(in# t(o statements: p%int 9 < 3 = ; ! ( p%int 9 < 3 = 4; ! (5 a. ,i''er by 80 b. *a%e c. ,i''er by 50 !. ,i''er by 1+0 Q>. Data an$ 'un+tion in (&i+& a%ea o' a +lass a%e $i%e+tl3 a++essi"le outsi$e t&e +lass, a. 0ublic b. 0ri2ate c. 0rotecte! !. )one o' these Q?. @e%e is an in'i9 notation: 44AAB5<C!4D!E55C4DAG5 C&oose t&e +o%%e+t post'i9 notation o' t&e a"o2e '%om t&e #i2en options. a. A34C,56--7849 b. A34C5,6--7849 c. A34C5,6-78-49 !. A43C5,6-78-49 Q . I' t&e $ept& o' a t%ee is - le2els6 t&en (&at is t&e si;e o' t&e T%ee, a. 2 b. c. + !. 8 QE. One o' t&e 'ollo(in# options is a 'o%m o' a++ess use$ to a$$ an$ %emo2e no$es '%om a 7ueue. a. :#7. b. 7#7. c. 3oth :#7. an! 7#7. !. )one o' these Q10. *&at is t&e time +omple9it3 o' a$$in# t&%ee mat%i+es o' si;e NFN +ell!"3!+ell, a. .;)< b. .;)92<

c. .;)9=< !. )one o' these

You might also like