wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PYTHON PROGRAMMING PRELIM-EXAM

Total questions: 60

Worksheet time: 27mins

Name
Class
Date
1.

What will be the output of the following code?

a)
  • A) Greater

b)
  • B) Smaller

c)
  • C) Error

d)
  • D) None

2.

What will be the output of the following code?

a)
  • A) Greater

b)
  • B) Smaller

c)
  • C) Error

d)
  • D) None

3.

What will be the output of the following code?

a)
  • A) Greater

b)
  • B) Smaller

c)
  • C) Equal

d)
  • D) Error

4.

What will be the output of the following code?

a)
  • A) Greater

b)
  • B) Smaller

c)
  • C) Equal

d)
  • D) Error

5.

What will be the output of the following code?

a)
  • A) Yes

b)
  • B) No

c)
  • C) Error

d)
  • D) None

6.

What will be the output of the following code?

a)
  • A) Yes

b)
  • B) No

c)
  • C) Error

d)
  • D) None

7.

What will be the output of the following code?

a)
  • A) Yes

b)
  • B) No

c)
  • C) Error

d)
  • D) None

8.

What will be the output of the following code?

a)
  • A) Greater

b)
  • B) Equal

c)
  • C) Smaller

d)
  • D) Error

9.

What will be the output of the following code?

a)
  • A) Both True

b)
  • B) Only x is True

c)
  • C) Both False

d)
  • D) Error

10.

What will be the output of the following code?

a)
  • A) x is True, y is False

b)
  • B) Both True

c)
  • C) x is False

d)
  • D) Error

11.

What will be the output of the following code?

a)
  • A) Negative

b)
  • B) Zero

c)
  • C) Positive

d)
  • D) Error

12.

What will be the output of the following code?

a)
  • A) Negative

b)
  • B) Zero

c)
  • C) Positive

d)
  • D) Error

13.

What will be the output of the following code?

a)
  • A) Negative

b)
  • B) Zero

c)
  • C) Positive

d)
  • D) Error

14.

What will be the output of the following code?

a)
  • A) x is greater than y

b)
  • B) x is less than y

c)
  • C) x is equal to y

d)
  • D) Error

15.

What will be the output of the following code?

a)
  • A) x is greater than y

b)
  • B) x is less than y

c)
  • C) x is equal to y

d)
  • D) Error

16.

What will be the output of the following code?

a)
  • A) Even

b)
  • B) Odd

c)
  • C) Error

d)
  • D) None

17.

What will be the output of the following code?

a)
  • A) Even

b)
  • B) Odd

c)
  • C) Error

d)
  • D) None

18.

What will be the output of the following code?

a)
  • A) Divisible by 3

b)
  • B) Not divisible by 3

c)
  • C) Error

d)
  • D) None

19.

What will be the output of the following code?

a)
  • A) Divisible by 3

b)
  • B) Not divisible by 3

c)
  • C) Error

d)
  • D) None

20.

What will be the output of the following code?

a)
  • A) Positive

b)
  • B) Single digit

c)
  • C) Positive Single digit

d)
  • D) Non-positive

21.

What is the output of the following code?

a)
  • A) Hello, World!

b)
  • B) "Hello, World!"

c)
  • C) None

d)
  • D) Error

22.

What will be the output of the following code?

a)
  • A) 2 + 3

b)
  • B) 5

c)
  • C) "5"

d)
  • D) Error

23.

What is the result of calling len() on a string in Python?

a)
  • A) 5

b)
  • B) 6

c)
  • C) 7

d)

D) Error

24.

What will be the output of the following code?

a)
  • A) 6

b)
  • B) 3

c)
  • C) 2

d)
  • D) Error

25.

What will be the output of the following code?

a)
  • A) 5

b)
  • B) -5

c)
  • C) 10

d)
  • D) Error

26.

What will be the output of the following code?

a)
  • A) 4

b)
  • B) 8

c)
  • C) 16

d)
  • D) Error

27.

What will be the output of the following code?

a)
  • A) Hello, Alice

b)
  • B) "Hello, Alice"

c)
  • C) Hello, "Alice"

d)
  • D) Error

28.

What will be the output of the following code?

a)
  • A) 5

b)
  • B) 5.0

c)
  • C) 10

d)
  • D) Error

29.

What is the output of the following code?

a)
  • A) Hello,

b)
  • B) Hello, Guest

c)
  • C) Hello, "Guest"

d)
  • D) Error

30.

What will be the output of the following code?

a)
  • A) 3

b)
  • B) 7

c)
  • C) 10

d)
  • D) Error

31.

What will be the output of the following code?

a)
  • A) 5

b)
  • B) 10

c)
  • C) 120

d)
  • D) Error

32.

What is the output of the following code?

a)
  • A) True

b)
  • B) False

c)
  • C) 0

d)
  • D) 1

33.

What will be the output of the following code?

a)
  • A) Hello, Alice

  • Hello, Bob

b)
  • B) Hello, Alice Hello, Bob

c)
  • C) Hello, "Alice" Hello, "Bob"

d)
  • D) Error

34.

What will be the output of the following code?

a)
  • A) 15

b)
  • B) [1, 2, 3, 4, 5]

c)
  • C) 10

d)
  • D) Error

35.

What is the output of the following code?

a)
  • A) Python

b)
  • B) nohtyP

c)
  • C) nohtyp

d)
  • D) Error

36.

What will be the output of the following code?

a)
  • A) 3

b)
  • B) 2

c)
  • C) 4

d)
  • D) Error

37.

What is the output of the following code?

a)
  • A) 20

b)
  • B) 14

c)
  • C) 9

d)
  • D) Error

38.

What will be the output of the following code?

a)
  • A) Positive

b)
  • B) Negative

c)
  • C) Zero

d)
  • D) Error

39.

What will be the output of the following code?

a)
  • A) JD

b)
  • B) J D

c)
  • C) John Doe

d)
  • D) Error

40.

What is the output of the following code?

a)
  • A) [0, 1, 1, 2, 3]

b)
  • B) [0, 1, 2, 3, 4]

c)
  • C) [0, 1, 1, 2, 3, 5]

d)
  • D) Error

41.

What will be the result of the expression len('Python')?

a)

5

b)

6

c)

7

d)

error

42.

What does the expression 4 ** 2 evaluate to?

a)

A) 16

b)

B) 8

c)

C) 4

d)

D) 2

43.

What is the value of the expression not (True or False)?

a)

A) True

b)

B) False

c)

C) 1

d)

D) 0

44.

What will be the result of the expression 10 // 3?

a)

A) 3

b)

B) 3.33

c)

C) 4

d)

D) 1

45.

What is the value of the expression True and False?

a)

A) True

b)

B) False

c)

C) 1

d)

D) 0

46.

What does the expression 5 >= 5 evaluate to?

a)

A) True

b)

B) False

c)

C) None

d)

D) Error

47.

What is the value of the expression 4 != 4?

a)

A) True

b)

B) False

c)

C) None

d)

D) Error

48.

What will be the result of the expression 5 == 5.0?

a)

A) True

b)

B) False

c)

C) None

d)

D) Error

49.

What will be the output of the following expression: 'A' < 'a'?

a)

A) True

b)

B) False

c)

C) None

d)

D) Error

50.

What will be the result of the expression 'Hello' + ' ' + 'World!'?

a)

A) HelloWorld!

b)

B) Hello World!

c)

C) Hello + World!

d)

D) HelloWorld!

51.

What will be the output of the following expression: 2 + 3 * 5?

a)

A) 25

b)

B) 17

c)

C) 13

d)

D) 10

52.

What is the value of the expression 7 % 3?

a)

A) 1

b)

B) 2

c)

C) 3

d)

D) 4

53.

What does the expression -5 + 3 evaluate to?

a)

A) -8

b)

B) -2

c)

C) 2

d)

D) -5

54.

What does the expression 3 > 2 and 2 < 5 evaluate to?

a)

A) True

b)

B) False

c)

C) None

d)

D) Error

55.

What is the result of the expression int('10') + float('20.5')?

a)

A) 30.5

b)

B) 205.0

c)

C) 1020.5

d)

D) Error

56.

What will be the output of the following expression: 3 + 4 2 / (1 - 5) * 2?

a)

3.5

b)

3.125

c)

2.5

d)

2.75

57.

What does the expression round(2.678, 2) evaluate to?

a)
  • 2.67

b)
  • 2.68

c)
  • 2.67.8

d)
  • 3

58.

What will be the output of the following expression: list(range(0, 10, 2))?

a)
  • [0, 2, 4, 6, 8]

b)
  • [0, 2, 4, 6, 8, 10]

c)
  • [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

d)

[2, 4, 6, 8]

59.

What does the expression {'a': 1, 'b': 2}.get('c', 3) evaluate to?

a)

1

b)

2

c)

3

d)

none

60.

What will be the result of the expression 'Python'[::-1]?

a)
  • Python

b)
  • nohtyP

c)
  • Error

d)
  • Pnohty