wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Mod 2 Test

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

What is the output of the following code?

y = 2 + 3 * 5.

print(Y)

a)

error

b)

25.

c)

17

d)

17.0

2.

What is the output of the following code if the user enters two lines containing 2 and 4 respectively?

x = input()

y= input()

print (x +y)

a)

2

b)

24

c)

4

d)

6

3.

The 0o prefix means that the numbers after it is denoted as:

a)

binary

b)

decimal

c)

hexadecimal

d)

octal

4.

The print() function can outpur values of:

a)

just one argument

b)

not more than five arguments

c)

any number of arguments (excluding zero)

d)

any number of arguments (including zero)

5.

The meaning of the keyword parameter is determined by:

a)

Its positions within the argument list

b)

its value

c)

the argument's name specified along with its value

d)

its connection with existing variables

6.

Which of the following variable names are illegal?

select two

a)

True

b)

true

c)

TRUE

d)

and

7.

What is the output of the following snippet (code) if the user enters two lines containing 2 and 4 respectively?

x = int(input())

y = int(input())

x = x//y

y= y//x

print(y)

a)

4.0

b)

error

c)

2.0

d)

8.0

8.

The ** operator

a)

preforms floating-point muliplication

b)

preforms duplicated muliplication

c)

preforms exponentiation

d)

does not exist

9.

The value twenty point twelve times ten raised to the power of eight should be written as:

a)

20.12E8

b)

20E12.8

c)

20.12*10^8

d)

20.12E8.0

10.

What is the output of the following snippet(code)?

x = 1

y = 2

z = x

x = y

y = z

print (x, y)

a)

2 1

b)

1 1

c)

2 2

d)

1 2

11.

What is the output of the following snippet if the user enters two lines containing 11 and 4 respectively?

x = int(input())

y = int(input())

x = x % y

x = x % y

y = y % x

print (y)

a)

2

b)

1

c)

4

d)

3

12.

The result of the following division:

1/1

a)

cannot be predicted

b)

1.0

c)

1

d)

cannot be evaluated

13.

What is the output of the following snippet?

x = 1 / 2 + 3 // 3 + 4 ** 2

print (x)

a)

17.5

b)

8.5

c)

8

d)

17

14.

The \n digraph forces the print() function to:

a)

output exactly two characters: \ and n

b)

duplicate the character next to the digraph

c)

stop its execution

d)

break the output line

15.

Which of the following statements are true?

Select two

a)

the ** operation used right -sided binding

b)

Addition precedes multiplication

c)

the results of the / operator is always an integer value.

d)

the right argument of the % operator cannot be zero.

16.

What is the output of the following snippet if the user enters tow lines containing 3 and 6 respectively?

x = input()

y = int(input())

print (x*y)

a)

333333

b)

36

c)

18

d)

666

17.

What is the output of the following snippet if the user enters two lines containing 2 and 4 respectively?

x = int(input())

y = int(input()_

print(x +y)

a)

2

b)

24

c)

4

d)

6

18.

What is the output of the following snippet?

z = y = x = 1

print(x,y,z, sep='*')

a)

1*1*1

b)

x y z

c)

1 1 1

d)

x*y*z

19.

What is the output of the following snippet if the user enters two lines containing 2 and 4 respectively

x = int(input())

y = int (input())

x = x / y

y = y / x

print(y)

a)

8.0

b)

error

c)

2.0

d)

4.0

20.

Left-sided binding determines that the result of the following expression:

1//2*3

is equal to:

a)

0

b)

0.0

c)

4.5

d)

0.16666666666