wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PCEP Practice Exam 2

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What do you expect the following code will print given the first input is

apple (stored in variable a) and the second input is banana (stored in

variable b)?

a)

apple:banana

b)

apple::banana

c)

banana:apple:

d)

banana::apple

2.

What will the output be after running the following code snippet?

a)

0

b)

4

c)

2

d)

1

3.

What will the output be after running the following code snippet?

a)

['bananas', '']

b)

['bananas']

c)

['apples']

d)

['apples', 'bananas', '']

4.

What will the output be after running the following code snippet?

a)

[7, 6, 5, 4, 3, 2, 1]

b)

[1, 2, 3, 4, 5, 6, 7]

c)

[1, 2, 3, 4, 5, 6]

d)

[2, 3, 4, 5, 6, 7]

5.

What will the output be after running the following code snippet?

a)

0b01

b)

0b11

c)

0b10

d)

10

6.

What is the output of the following program?

a)

1

b)

9

c)

10

d)

90

7.

What will the output be after running the following code snippet?

a)

Not equal

b)

Equal

c)

False

d)

True

8.

What will the output be after running the following code snippet?

a)

4

b)

error

c)

1

d)

9

9.

What is the output of the following snippet of code:

a)

2

b)

3

c)

Nothing is printed

d)

0

10.

What will the output be after running the following code snippet?

a)

Values are the same

b)

Values are different

c)

True

d)

False

11.

What do you expect the following code to print:

a)

[5, 4, 3, 2, 1]

b)

[1, 2, 3, 4, 5]

c)

[1, 2, 3, 4]

d)

[5, 1, 2, 3, 4]

12.

What will the output be after running the following code snippet?

a)

100

b)

20

c)

error

d)

x not defined

13.

What will the output be after running the following code snippet?

a)

[1, 1, 2, 2, 3, 3]

b)

[1, 2, 3, 1, 2, 3]

c)

[1, 2, 3, 3, 2, 1]

d)

[1, 2, 3]

14.

What will the output be after executing the following code snippet?

a)

error

b)

Yes

c)

No

d)

0

15.

What will the output be after running the following code snippet?

a)

hello prof karamagi

b)

HelloProfKaramagi

c)

Hello prof karamagi

d)

Hello Prof Karamagi

16.

What will the output be after running the following code snippet?

a)

(1, 2, 3), ('apples', 'banana', pears')

b)

(1, 2, 3) + ('apple', 'banana'. 'pears')

c)

(1, 2, 3, 'apples', 'banana', 'pears')

d)

('apple, 'banana', 'pears', 1, 2, 3)

17.

What will happen if the following snippet of code is executed?

a)

Hello ""

b)

Hello "name"

c)

Hello, name

d)

Hello

18.

What will the output be after running the following code snippet?

a)

Robert,Karamagi

b)

Robert ","Karamagi

c)

Robert Karamagi

d)

RobertKaramagi

19.

What will the output be after running the following code snippet?

a)

No Class

b)

First Class

c)

Second Class

d)

Third Class

20.

What will the output be after running the following code snippet?

a)

64

b)

12

c)

7

d)

6

21.

What will the output be after running the following code snippet?

a)

--

b)

"

c)

Nothing; no newline/blank

d)

'--'

22.

What will the output be after running the following code snippet?

a)

[[10, 2, 3]]

b)

[[1, 2, 3]]

c)

[[10, 1, 2, 3]]

d)

[[10]]

23.

What will the output be after running the following code snippet?

a)

not valid

b)

greater than 10

c)

less than 10

d)

syntax error

24.

What will the output be after running the following code snippet?

a)

{'one': 0, 'two': 1}

b)

{'one': 0, 'two': 2}

c)

{'one': 1, 'two': 2}

d)

{'one': 1, 'two': 0}

25.

What will the output be after running the following code snippet?

a)

Python,Python

b)

Python','Python

c)

PythonPython

d)

Python,*2

26.

What will the output be after running the following code snippet?

a)

error

b)

('Peter', 'Piper', 'Pickled', 'Pepper')

c)

('Peter')

d)

['Peter', 'Piper', 'Pickled', 'Pepper']

27.

What do you expect to be output to the console?

a)

False

b)

True

c)

Python is Awesome!

d)

Hello, World!

28.

What will the output be after running the following code snippet?

a)

error

b)

2

c)

2.0

d)

5

29.

What do you expect the following code snippet to printout:

a)

('P', 'y', 't', 'h', 'o', 'n')

b)

('W', 'o', 'r', 'l', 'd', '!')

c)

('n', 'o', 'h', 't', 'y', 'P')

d)

[P, y, t, h, o, n]

30.

What will the output be after running the following code snippet?

a)

6

b)

4

c)

9

d)

error