June 2023 GESP Competency Level Certification Python Level 1 Real Exam Questions

2023-06 GESP level test Python level 1 real questions

Number of questions: 27

Score: 100

Test duration: 90min

1. Multiple-choice questions (2 points each, 30 points in total)

1. The following are not computer output devices (A). (2 minutes)

A. Microphone

B. Speaker

C. Printer

D. Monitor

2. ChatGPT is a chatbot program developed by OpenAI. It can conduct conversations by understanding and learning human language, and can also interact based on the context of the chat to complete a lot of work. Please guess, among the following tasks, ChatGPT cannot complete (C). (2 minutes)

A. Change email

B. Script

C. mop the floor

D. Write code

3. The value of the Python expression 2+3**2*3 is (D). (2 minutes)

A.  15625

B.  731

C.  75

D.  29

4. The output after execution of the Python statement print(5//2*3,5%2*3) is (C). (2 minutes)

A.  0 5

B.  05

C.  6 3

D.  63

5. When executing the Python statement a = int(input()), if 3.14 is entered, the following statement is correct (D). (2 minutes)

A. Variable a will be assigned the integer value 3

B. Variable a will be assigned a floating point number 3.14

C. Variable a will be assigned the integer value 4

D. An error will be reported when executing the statement

6. The output of the following Python code after execution is (B). (2 minutes)

n =18
if n % 3:
	print(0, end="#")
else:
	print(1, end="#")
if n % 5:
	print(0)
else:
	print(1)

A.  0#1

B.  1#0

C.  0#0

D.  1#1

7. The output of the following Python code after execution is (A). (2 minutes)

tnt = 0
for i in range(-50,50):
	tnt += i
print(tnt)

A.  -50

B.  0

C.  50

D.  100

8. The output of the following Python code after execution is (A). (2 minutes)

tnt = 0
for i in range(10,2):
	tnt += i
print(tnt)

A.  0

B.  3

C.  20

D.  25

9. The output of the following Python code after execution is (B). (2 minutes)

tnt = 9
for i in range(2,6):
	if i % 2:
		tnt += i
print(tnt)

A.  6

B.  8

C.  12

D.  14

10. The output of the following Python code after execution is (D). (2 minutes)

n = 10
tnt = 0
while n != 9:
	if n %3:
		tnt += n
	n -= 1
print(tnt)

A.  18

B.  22

C.  33

D.  37

11. The following description of the Python code after execution is correct (B). (2 points)i

import turtle
for i in rage(10):
	if i % 2 == 0:
		turtle.pencolor("red")
	else:
		turtle.pencolor("blue")
	turtle.forward(i * 10)

A. There are 4 blue line segments and 5 red line segments, a total of 9 line segments

B. There are 4 red line segments and 5 blue line segments, a total of 9 line segments

C. There are 5 blue line segments and 5 red line segments, a total of 10 line segments

D. There are 5 red line segments and 5 bar-colored line segments, a total of 10 line segments.

12. The output of the following Python execution is (A). (2 minutes)

import turtle
for i in rage(10):
	turtle.circle(i * 10)

A.

B.

C.

D. None of the above is correct

13. The correct graph after executing the following Python code is (A). (2 minutes)

import turtle
for i in range(5):
	if i % 2 ==0:
		turtle.right(90)
		turtle.pencolor("red")
	else:
		turtle.left(90)
		turtle.pencolor("blue")
	turtle.forward(10 * 15 - 10 * i)

A.

B.

C.

D.

14. In order to draw the graph as shown below, (A) should be filled in the horizontal line of the Python code below. (2 minutes)

import turtle
for i in range(5)
	turtle.penup()
	turtle.goto(_______)
	turtle.pendown()
	turtle.circle(40 steps = 4)

A.  i*80,0

B.  i*40,0

C.  0,i*80

D.  0,i*40

15. In order to draw the graph as shown below, (D) should be filled in the horizontal line of the Python code below. (2 minutes)

import turtle
for i in range(5):
	turtle.left(90)
	turtle.circle(40, ______)
	turtle.goto(80 * ( i + 1), 0)
	turtle.left(90)

A.  -180

B.  -90

C.  90

D.  180

2. True or False Questions (2 points each, 20 points in total)

1. Computer hardware mainly includes arithmetic units, controllers, memories, input devices, and output devices. (right)

2. The 103 machine, born in 1958, was China's first general-purpose digital electronic computer, more than ten years later than the first general-purpose electronic computer ENIAC, which was born in the United States in 1946. (right)

3. In the Python code, the variable n is assigned a positive integer, then the value of the expression print(n % 10) is the single digit of the positive integer n. (wrong)

4. The order of sep and end in the Python statement print(2,3,sep="#",end="->") cannot be changed. (wrong)

5. The Python function input() can input strings, integers, floating point numbers, etc. (wrong)

6. The value of the Python expression int("10"*2)+10 is the integer 30. (wrong)

7. In Python, you can usually use while to simulate a for-in loop, but for-in may not be able to simulate a while loop. (right)

8. In Python code, you can name the variable print. Although print is the name of the output function, this variable is very poorly named. (right)

9. The following Python code will draw a red filled circle. (wrong)

import turtle
turtle.fillcolor("red")
turtle.circle(20)

10. After the Python code turtle.forward() is executed, the turtle's orientation will not be changed. (right)

3. Programming questions

Question 1

【Problem Description】

Xiao Ming is planning study time for himself. Now he wants to know how many minutes there are between two moments, can you help him do it through programming?

[Enter description]

Enter 4 lines, the first line is the hour of the start time, the second line is the minute of the start time, the third line is the hour of the end time, and the fourth line is the minute of the end time. The input ensures that the two moments are on the same day, and the start time must be before the end time. The time uses the 24-hour clock, that is, the hour is between 0 and 23, and the minute is between 0 and 59.

[Output description]

Output a line containing an integer, the number of minutes between the start time and the end time.

[Sample input 1]

9

5

9

6

[Sample output 1]

1

[Sample input 2]

9

5

10

0

[Sample output 2] 55

Reference Code:

h1 = int(input()) 
m1 = int(input())
h2 = int(input()) 
m2 = int(input())
print(h2*60+m2-h1*60-m1)

Question 2

【Problem Description】

1. Cumulative addition, in the form:

1+(1+2)+(1+2+3)+(1+2+3+4)+  +(1+2+3+4+5+    +n)1+(1+2)+(1+2+3)

+(1+2+3+4)+......+(1+2+3+4+5+   +n);

2. Use the input() statement to enter a positive integer greater than 1;

3. Observe the relationship between the latter item and the previous item;

[Enter description]

1. Enter a positive integer greater than 1, assuming that the input is compliant, regardless of non-compliant scenarios, such as numbers with decimal points, negative numbers, etc.;

2. Special tip: In regular programs, it is a good habit to have prompts when typing. Due to system restrictions during the exam, all input() functions cannot have prompt messages during input.

[Output description]

Output the result of cumulative addition

[Sample input 1]

3

[Sample output 1]

10

[Sample input 2]

4

[Sample output 2]

20

[Sample input 3]

10

[Sample output 3]

220

Reference procedure:

#计算:1+(1+2)+(1+2+3)+(1+2+3+4)+......+(1+2+3+4+	+n)
N = int(input())
allTnt = 0 #保存全部序列之和subTnt = 0 #保存子序列之和
for i in range(1,N+1): 
	subTnt += i 
	allTnt += subTnt
print(allTnt)

Guess you like

Origin blog.csdn.net/m0_46227121/article/details/131360418