Sample Questions - Past Tests
Sample Questions - Past Tests
Question 2
What is the output resulting from the complete execution of the following program?
A) EFAB
B) EA
C) AA
D) ABAB
E) None of the above
1
Question 3
What is the output resulting from the complete execution of the following program?
A) 1
B) 2
C) 3
D) 4
E) None of the above
2
Question 4
What is the output resulting from the complete execution of the following program?
A) 1
B) The program has an infinite loop.
C) -1
D) 0
E) None of the above
Question 5
What is the output resulting from the complete execution of the following program?
A) 11
B) 10
C) 3
D) The program will have a compilation error
E) None of the above
3
Question 6
What is the output resulting from the complete execution of the following program?
A) 3
B) 1
C) 2
D) -2
E) None of the above
Question 7
What is the output resulting from the complete execution of the following program?
A) 29
B) 4
C) 1
D) 2
E) None of the above
4
Question 8
What is the output resulting from the complete execution of the following program?
A) -1
B) 6
C) 4
D) 0
E) None of the above
5
Question 9
What is the output resulting from the complete execution of the following program?
A) -3
B) -1
C) -7
D)The program has an error and can't run
E) None of the above
6
Question 10
What is the output resulting from the complete execution of the following program?
A)1.0
B)2.0
C)3.0
D)6.0
E) None of the above
Question 11
Given the data assigned to the string variable y shown below, which of the following statements
will assign the value THIS to the string variable x?
A) x = y[7:10]
B) x = y[:10]
C) x = y[7:]
D) x = y[7:11]
E) None of the above
7
Question 12
What is the output resulting from the complete execution of the following program?
A) true
B) false
C) yes
D) no
E) None of the above
8
Question 13
What is the output resulting from the complete execution of the following program?
A) one
B) two
C) five
D) seven
E) None of the above
Question 14
What is the output resulting from the complete execution of the following program?
A) 11
B) 12.5
C) 12
D) The code will not compile because it includes a syntax error
E) None of the above
9
Question 15
What is the output resulting from the complete execution of the following program?
A) 21
B) 20
C) 22
D) The program will have a runtime error
E) None of the above
Question 16
What is the output resulting from the complete execution of the following program?
A) 8
B) 18
C) 64
D) 72
E) [None of the above
10
Question 17
What is the output resulting from the complete execution of the following program?
A) 0
B) 1
C) 2
D) 3
E) None of the above
11
Question 18
What is the output resulting from the complete execution of the following program?
12
A) 2
B) 5
C) 10
D) 12
E) None of the above
13
Question 19
What should the comment line #TODO be replaced with for the following program to display
the highest number in the list B? Note: random( ) is a function of the random module that
returns a random real number between 0 and 1.
A) max(B)
B) max(self.B)
C) max(cls.B)
D) B.max()
E) None of the above
14
Question 20
What should the comment line #TODO be replaced with for the following program to display
the following pattern?
0 00
1 0011
2 001111
3 00111122
4 0011112222
5 001111222233
6 00111122223333
A) k_ = k_ + 11
B) k_ = k_ + 1
C) if flag_:
k_= k_ + 1
D) if flag_:
k_= k_ + 11
15
Question 21
What is the output resulting from the complete execution of the following program?
A) 0
B) 3
C) 4
D) 5
E) None of the above
16
Question 22
What is the output resulting from the complete execution of the following program?
A) 2
B) 1
C) X 35 Y 11
D) Error
E) None of the above
17
Question 23
What should the comment line #TODO be replaced with for the program t95.py, given below, to
compute and output the average vehicle price?
A) a.append(value.price)
B) a.append(value[key].price)
C) a[int(key)] = value[key].price
D) a[int(key)] = value.price
E) None of the above
18
Question 24
What does the following program do?
19
Question 25
What will be the output resulting from the execution of the following
program?
A) 1
B) 2
C) 3
D) 12
E) None of the above
20