comp sci final practice Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

for the given psewudo code sum/val problem

A

sum = 0 / sum = sum + val

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

given pseudocode – count problem which xxx and yy will blah blah

A

count = count + 1 / nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

for the given pseudocode, which xxx and yyy will output the smallest non negative

A

val < min / min = val

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

which input for char c causes “Done” to be output next

A

No such value (error comparing c and ‘y’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the output if the input is 3 2 1 0

A

6 6 6 6 6 6 6 (infinite loop)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

which xxx and yyy will loop as long as the input is an integer less than 10

A

w < 100 / cin&raquo_space; w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how many times will the loop iterate if the input is 105 107 99 103

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

a loop should sum all inputs, stopping when the input is 0. if the input is 2 4 6 0, sum shoiuld end with 12. what should xxx, yyy, and zzz be? choices are in the form XXX/ YYY/ ZZZ

A

sum = 0; currVal != 0/ sum = sum + currVal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how many times does the while loop execute for the given input values of -1 4 0 9?

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is the output int x = 18

A

18 6 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

which loop will iterate 100 times

A

for (int i = 0; i < 100; i++)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is the output if the input is 3 2 4 5

A

245

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the ending value of sum, if the input is 2 5 7 3

A

12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is the output if the count is 4?

A

4321

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is the output?

int n;
for (n = 0; n < 10; n = n + 2) {
cout &laquo_space;n + wtv

A

0 3 6 9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

the program should determine the largest integer seen

A

maxSoFar = currValue

17
Q

the program shoukd output even values betwen -10 and 10

A

i = -10; i <= 10; i = i+2

18
Q

which xxx causes every character in string to be output

A

i = 0; i < inputWord.length; i++