wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PCEP Practice Exam 1

Total questions: 30

Worksheet time: 45mins

Name
Class
Date
1.

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

a)

3

b)

9

c)

1

d)

18

2.

What will the output be, if we run the following code?

a)

Monday, Tuesday, Wednesday, Thursday

b)

Friday

c)

None

d)

AttributeError: 'tuple' object has no attribute 'append'

3.

How many times will it print "#"?

a)

1

b)

2

c)

3

d)

4

4.

What is the output of this code when "robert" is entered by the user when prompted?

a)

True

b)

error

c)

Robert

d)

False

5.

What would be printed to the console after the following code is executed?

a)

Hello

b)

"Hello", World

c)

Hello World

d)

Hello, World

6.

What will the output be after executing the following code?

a)

('Python', 'Tuple')

b)

[Python, Tuple]

c)

['Python', 'Tuple']

d)

(Python, Tuple)

7.

What is the output when the following code snippet is run:

a)

Error

b)

None

c)

Let's enjoy a bowl of cereals

d)

Groceries trip pending

8.

What will the output be after executing the following code?

a)

[6]

b)

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

c)

-6

d)

(0,1,2,3,4)

9.

What will the output be after executing the following code?

a)

dict{'Python', 'Dictionaries'}

b)

dict({'Python', 'Dictionaries'})

c)

{'Python', 'Dictionaries'}

d)

{1: 'Python', 2: 'Dictionaries'}

10.

What is the output of this code after the user inputs "Python" when prompted?

a)

PythonPythonPython

b)

error

c)

Python*3

d)

Python Python Python

11.

What will the output be after running the following code?

a)

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

b)

(0,1,2,3,4,5,6)

c)

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

d)

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

12.

What will the output be, if we execute the following code?

a)

{'Name': 'Python', [1, 2, 3, 4], 'hi'}

b)

{'Name': 'Python', 1: [1, 2, 3, 4], 2: 'hi'}

c)

Syntax Error

d)

{'Python', [1, 2, 3, 4], 'hi'}

13.

What will the output be, if we run the following code?

a)

0 1

1 1

0 0

1 0

b)

0 1

0 0

1 1

1 0

c)

0 1

0 0

1 0

1 1

d)

0 1

1 1

1 0

0 0

14.

What will the output be after executing the following code?

a)

Hello "\nPython!"

b)

Hello Python!

c)

Hello

Python!

d)

Hello \nPython!

15.

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

a)

Robert method karamagi

b)

Robert method Karamagi

c)

Robert Method Karamagi

d)

ROBERT METHOD KARAMAGI

16.

What will the output be after calling the following function?

a)

6

b)

Syntax Error

c)

6 5

d)

5

17.

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

a)

19

b)

Syntax Error

c)

True

d)

False

18.

What would be printed to the console after the following code is

executed?

a)

2,4,6,8,10,

b)

2,4,6,8,

c)

1,3,5,7,9,

d)

1,3,7,9,

19.

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

a)

Nothing is printed

b)

3

c)

-1

d)

P

20.

What will the output be, if we run the following code?

a)

No Output

b)

{1: One, 2: Two}

c)

{1:"One", 2:"One"}

d)

{1: "One",1 : "One"}

21.

What will the output be after running the following code?

a)

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

b)

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

c)

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

d)

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

22.

What is the output of this code when 'wi' and 'fi' are entered by the user

when prompted and stored in a and b, respectively?

a)

wifiwiwifi

b)

wifiwifiwifi

c)

wifififi

d)

wififififi

23.

What will the output be after executing the following code?

a)

Hello#World#Python

b)

error

c)

#Hello#World#Python

d)

HelloWorldPython#

24.

What is the output of the following code?

a)

error

b)

4

c)

2

d)

1

25.

What is the output of the following code?

a)

error

b)

<class 'int'>

c)

<class 'tuple'>

d)

Invalid Data Type

26.

What will the output be after running the following code?

a)

odd

b)

even

27.

What will the output be after running the following code?

a)

error

b)

5 10

c)

10 5

d)

Prints nothing

28.

What will the output be after running the following code?

a)

Prints nothing

b)

1 5

c)

error

d)

5 1

29.

Will the following code run without errors?

a)

This code will run without errors.

b)

This code will not run.

30.

What is the output after executing the following code?

a)

Oranges Mangoes

b)

Apple Mangoes

c)

Apple Oranges

d)

Apple Oranges Mangoes