Module 2 Flashcards

PCEP certification

1
Q

The escape character owes its name to the fact that it:

A. changes the meaning of the character next to it
B. cannot be caught due to its high speed
C. escapes from the source files into the computer memory

A

A. changes the meaning of the character next to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The meaning of the positional parameter is determined by its:

A. name
B. appearance
C. position

A

C. position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The most important difference between integer and floating-point numbers lies in the fact that:

A. they cannot be used simultaneously
B. integers cannot be literals, floats can
C. they are stored differently in the computer memory

A

C. they are stored differently in the computer memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The 0x prefix means that the number after it is denoted as:

A. a hexadecimal
B. a decimal
C. an octal

A

A. a hexadecimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The // operator:

A. performs regular division
B. performs integer division
C. does not exist

A

B. performs integer division

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The result of the following addition:
123 + 0.0

A. cannot be evaluated
B. is equal to 123.0
C. is equal to 123

A

B. is equal to 123.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Only one of the following statements is true - which one?

A. multiplication precedes addition
B. addition precedes multiplication
C. neither statement can be evaluated

A

A. multiplication precedes addition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Right-sided binding means that the following expression:
1 ** 2 ** 3
will be evaluated:

A. in random order
B. from left to right
C. from right to left

A

C. from right to left

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A keyword is a word that: (Select two answers)

A. cannot be used as a variable name
B. is the most important word in the whole program
C. cannot be used as a function name

A

A. cannot be used as a variable name
C. cannot be used as a function name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A value returned by the input() function is:

A. a string
B. an integer
C. a float

A

A. a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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. 4.0
B. 2.0
C. 8.0
D. the code will cause a runtime error

A

D. the code will cause a runtime error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A. decimal
B. hexadecimal
C. binary
D. octal

A

D. octal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following variable names are illegal? (Select two answers)

A. true
B. and
C. TRUE
D. True

A

B. and
D. True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The result of the following division:
1 /1

A. cannot be predicted
B. is equal to 1.0
C. cannot be evaluated
D. is equal to 1

A

B. is equal to 1.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the output of the following snippet if the user enters two lines containing 3 and 6 respectively?
x = input()
y = int(input())
print(x * y)

A. 18
B. 36
C. 666
D. 333333

A

D. 333333

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The ** operator:

A. does not exist
B. performs floating-point multiplication
C. performs exponentiation
D. performs duplicated multiplication

A

C. performs exponentiation

17
Q

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. 1
B. 3
C. 4
D. 2

18
Q

The print() function can output values of:

A. any number of arguments (including zero)
B. just one argument
C. not more than five arguments
D. any number of arguments (excluding zero)

A

A. any number of arguments (including zero)

19
Q

Which of the following statements are true? (Select two answers)

A. The result of the / operator is always an integer value.
B. The ** operator uses right-sided binding.
C. The right argument of the % operator cannot be zero.
D. Addition precedes multiplication.

A

B. The ** operator uses right-sided binding.
C. The right argument of the % operator cannot be zero.

20
Q

What is the output of the following snippet?
z = y = x = 1
print(x, y, z, sep=’*’)

A. 111
B. 1 1 1
C. xyz
D. z y z

21
Q

The meaning of the keyword parameter is determined by:

A. its value
B. its connection with existing variables
C. the argument’s name specified along with its value
D. its position within the argument list

A

C. the argument’s name specified along with its value

22
Q

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

A. 20.12*10^8
B. 20.12E8
C. 20.12E8.0
D. 20E12.8

A

B. 20.12E8

23
Q

What is the output of the following snippet if the user enters two lines containing 2 and 4 respectively?
x = input()
y = input()
print(x + y)

A. 2
B. 24
C. 6
D. 4

24
Q

What is the output of the following snippet?
x = 1 / 2 + 3 // 3 + 4 ** 2
print(x)

A. 17
B. 17.5
C. 8.5
D. 8

25
The \n digraph forces the print() function to: A. duplicate the character next to the digraph B. stop its execution C. output exactly two characters: \ and n D. break the output line
D. break the output line
26
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. 4.0 B. 8.0 C. the code will cause a runtime error D. 2.0
B. 8.0
27
Left-sided binding determines that the result of the following expression: 1 // 2 * 3 is equal to: A. 0.0 B. 0.166666666666666 C. 0 D. 4.5
C. 0
28
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. 6 B. 24 C. 4 D. 2
A. 6
29
What is the output of the following snippet? 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
A. 2 1
30
What is the output of the following snippet? y = 2 + 3 * 5. print(Y) A. the snippet will cause an execution error B. 25. C. 17.0 D. 17
A. the snippet will cause an execution error