Docsity

Major Field Test in Computer Science Sample Questions, Exercises of Computer Science

Toggle sidebar
bg1
Major Field Test in Computer Science
Sample Questions
The following questions illustrate the range of the test in terms of the abilities measured,
the disciplines covered, and the difficulty of the questions posed. They should not,
however, be considered representative of the entire scope of the test in either content or
difficulty. The notation pages and the answer key follow the questions.
x
int i 1
int j 1
while ( i < 10 )
j j * i
i i + 1
if ( i == x )
break
end if
end while
while
( i == 10 ) ( i == x )
x > 10 i == 10
j == 6 x == 4
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Major Field Test in Computer Science Sample Questions and more Exercises Computer Science in PDF only on Docsity!

Major Field Test in Computer Science

Sample Questions

The following questions illustrate the range of the test in terms of the abilities measured, the disciplines covered, and the difficulty of the questions posed. They should not, however, be considered representative of the entire scope of the test in either content or difficulty. The notation pages and the answer key follow the questions.

x

int i  1 int j  1

while ( i < 10 ) j  j * i i  i + 1 if ( i == x ) break end if end while

while

( i == 10 ) ( i == x ) x > 10 i == 10 j == 6 x == 4

A[0..N-1] and a variable pos_._ The push and pop operations are defined by the following code.

push (x) A[pos]  x pos  pos – 1 end push

pop ( ) pos  pos + 1 return A[pos] end pop

N

pos  - pos  0 pos  1 pos  N - 1 pos  N

int Fun ( int n ) if ( n == 4 ) return 2 else return 2 * Fun ( n + 1 ) end if end Fun

Fun ( 2 )

2 4 8 16 24

A[0..n-1] n Swap A

int j  0 while ( j < n - 1 ) int k  0 while ( k < n - j - 1 ) if ( A[k] < A[k + 1] ) Swap ( A[k], A[k + 1] ) end if k  k + 1 end while j  j + 1 end while

A n Swap

n - 1 n n(n - 1)/ (n - 1)(n - 2) n(n - 1)

widget A widget byte short int long

struct widgets A

struct widget short s byte b long l int i end widget

widget A[10]

A A

lw

lw

  • P 1 , P 2 , P 3 , P - P - P - P
    • P

Major Field Test in Computer Science

Notation, Conventions, and Definitions

êë úû

éê ùú

( ) =W( ( )) ( ) ( )

( ) =Q( ( )) g n ( ) f n ( )

Ø Ø

Ú +

Å Ù Æ È Ç - Í

Ì Í

x + y { } È{ }

ST = (^) { xy x Î S and y Î T }

  • S È T ;

Sn

S + È^ È^ È

{ } È + a ® b