Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

P2 Exam: ITE 260 A1

Total questions: 34

Worksheet time: 18mins

Name
Class
Date
1.

What is the output of the following if statement?

a)

y is greater than x

b)

Error

c)

No output

d)

20

2.

What will be printed on the screen from the code:

a)

80

b)

Alright…

c)

True

d)

False

3.

What will be printed on the screen from the code:

a)

30

b)

Okay…

c)

True

d)

False

4.

What will be printed on the screen from the code:

a)

200

b)

Hello…

c)

No output

d)

True

5.

What will be printed on the screen from the code:

a)

30

b)

Yes…

c)

No output

d)

True

6.

What is the output of the following statement? N=10 if(N<=50 or N>=100): print(N)

a)

N

b)

True

c)

No output

d)

10

7.

What is the output of the following statement?

a)

False

b)

True

c)

No output

d)

Error

8.

What is the output of the following statement?

a)

2

b)

0

c)

3

d)

4

9.

What does the following statement display?

a)

0
0
0
0

b)

0
1
2
3

c)

1
2
3

d)

nothing

10.

What does the following statement display?

a)

5
7
9

b)

5
6
7
8
9

c)

5
7
9
11

d)

5
10
15
20

11.

What does the following statement display?

a)

10 - 15 - 20

b)

c - c - c

c)

10

d)

nothing

12.

What does the following program segment display?

a)

1 5
2 6
3 7

b)

1 5
2 7
3 9

c)

1 5
2 6
3 7
4 8

d)

1 5
2 7
3 9
4 1

13.

What does the following program segment display? for x in range(2,5): print("x")

a)

2
3
4

b)

2
3

c)

x
x
x
x

d)

x
x
x

14.

What does the following program segment display?

a)

10

b)

10 10

c)

20

d)

d d

15.

What is the output of the following code segment?

a)

AAA

b)

BBB

c)

AAABBB

d)

AAA
BBB

16.

What does the following loop print? for i in range(1,4): print(i * 2)

a)

2
4

b)

2
3
4

c)

1
2
3

d)

2
4
6

17.

What is the result of the following expression?

print(5 + 3 * 2)

a)

16

b)

11

c)

10

d)

8

18.

The assignment operator in Python is =

a)

True

b)

False

19.

The equality relational operator in Python is ==

a)

True

b)

False

20.

The operator and returns true if both statements are true.

a)

True

b)

False

21.

The operator or returns false if both statements are false.

a)

True

b)

False

22.

The break statement skips the rest of the current iteration; loop proceeds with the next one.

a)

True

b)

False

23.

In Python, only conditional statements are allowed to use else.

a)

True

b)

False

24.

Let: a = 10, b = 5. The statement a != b will return false.

a)

True

b)

False

25.

In Python, the value of (4 > 7) is true.

a)

True

b)

False

26.

From the code:

x = len("God bless everyone!")
print(x)

Answer: (a)  

27.

From the code, what is the output?

x = round(3.1762, 2)
print(x)

What will be the rounded output from x? Answer: (a)  

28.

From the code, what will be the screen output?

mylist = [1, 4, 2, 9, 7, 2, 1, 8, 3, 3, 2, 1]

print(max(mylist), min(mylist))

(a)  

29.

From the code, what would be the output?

x = pow(3, 4)
print(x)


(a)  

30.

From the code, what is the output?

txt = "pYtHon is FuN!"

x = txt.capitalize()
print(x)


(a)  

31.

From the code, what would be the output?

text = "Southwestern University"

z = text.upper()
print(z)


(a)  

32.

From the code, what is the output?
txt = "240 Arellano Street"
x = txt.isalpha()
print(x)


(a)  

33.

From the code, what is the output?
data = [10, 20, 30, 40]

print(sum(data) / len(data))

(a)  

34.

From the code, what is the output?
data = [10, 20, 30, 40]

print(min(data) + max(data))

(a)