Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

2025 Youth Information Literacy Competition Algorithm Creativity C++

1.

【Multiple Choice Questions】 (5 points each)

Question 1

In C++, which symbol represents the logical operator “or”?

A. ||

B. &

C. ==

D. @

Question 2

What is the output of the following code when the input is 3? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. -n

B. 0

C. 9

D. 81

Question 3

Which of the following options outputs 0? ( )

A. cout << “5 – 5”;

B. cout << 5 – 5;

C. cout << 2 * 3;

D. cout << 7 / 2;

Question 4

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

cout << 10 % 3;

A. 1

B. 2

C. 5

D. 10

Question 5

Which of the following is not part of the basic C++ program structure? ( )

A. Header files

B. Namespace

C. Main function

D. Program development time: 2025-03-23

Question 6

Read the following program, what is the output when the input is 1 5? ( )

int a,b;

cin >> a >> b;

a += b;

b *= a;

cout << a << ” ” << b << endl;

A. 1 5

B. 6 5

C. 5 6

D. 6 30

Question 7

What is the expression to get the digit in the tens place of a four-digit integer in a C++ program? ( )

A. number / 1000

B. number / 100 % 10

C. number / 10 % 10

D. number % 10

Question 8

The following program separates the digits of a positive integer n and prints each digit in reverse order. What should be filled in at position ①? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. n > 0

B. n >= 0

C. n < 0

D. n <= 0

Question 9

The following program outputs “1 4 7 10”. Which option correctly completes the code at position ①? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. i++

B. i *= 2

C. i += 3

D. i * 2

Question 10

What is the output of the following code? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. 1

B. 2 4

C. 1 3 5

D. 1 2 3 4

Question 11

The following diagram shows the output pattern when n = 5. What should be filled in at position ① to output a special right triangle with n+1 rows? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. j <= 2 * i

B. j <= i

C. j <= 2 * i – 1

D. j <= 2 * i + 1

Question 12

What is the output of the following program segment? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. 40

B. 60

C. 90

D. 120

Question 13

What is the output of the following code? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A.

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

1 2 3 4 5

B.

5 4 3 2 1

5 4 3 2 1

5 4 3 2 1

5 4 3 2 1

C.

1 2 3 4

1 2 3 4

1 2 3 4

1 2 3 4

D.

5 4 3 2 1

5 4 3 2 1

5 4 3 2 1

Question 14

What is the output when the following program is executed with input 5? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. 5

B. 30

C. 55

D. 85

Question 15

What is the output when the following program is executed with input 6? ( )

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

A. QWER

B. WERQ

C. ERQW

D. RQWE

2.

【True/False Questions】 (5 points each)

Question 16

In C++, && represents the logical operator “or”.

True

False

Question 17

In C++, you can define and initialize an array like this: int c[3]={1,2,3,4,5}

True

False

Question 18

In C++, the index of a one-dimensional array starts from 0.

True

False

Question 19

Code segment

Summary of C++ Programming Preliminary Questions for the 2025 Information Literacy Competition for Elementary School Students

The final value is -1.

True

False

Question 20

After defining int arr[5]; executing arr[5]=5 will not cause an array out of bounds.

True

False

3.

Reference Answers

Question 1: Answer: A

|| is or, && is and

Question 2: Answer: B

n-3=3-3=0

Question 3: Answer: B

5-5=0

Question 4: Answer: A

10 ÷ 3 = 1…1, so the remainder is 1

Question 5: Answer: D

Question 6: Answer: D

a: a+=b 1+5=6

b: 5*6=30

Question 7: Answer: C

number/10 removes the unit digit

number%10 keeps the unit digit (i.e., the tens digit)

Question 8: Answer: A

while(n>0) n>0 repeats until n=0 exits the loop

while(n) until n=0 exits the loop

while(n!=0) n not equal to 0 repeats

Question 9: Answer: D

i starts from 1 to 10, if it outputs 1 4 7 10

then the interval is 3, i+=3;

Question 10: Answer: C

i: 1,2,3,4,5

If it is a multiple of 2 (even), skip, otherwise output, hence 1,3,5

Question 11: Answer: B

i: 1-5, so for row count 1,2,3,4,5

j: j=1; j=i, j++, same number per row

*

**

***

****

*****

Question 12: Answer: A

i loops 5 times, j loops 4 times, k loops 2 times. So total loops 5*4*2=40

Question 13: Answer: B

Key inner loop j: from 5 to 1, outer loop i loops 4 times. So select B

Question 14: Answer: C

Input 5. Loop 5 times: 1*1, 2*2, 3*3, 4*4, 5*5, total sum is 55

Question 15: Answer: A

Multiples of 2 output QWER

Multiples of 3 output WERQ

Multiples of 5 output ERQW

Otherwise, other multiples output RQWE

6 is a multiple of 2, hence output QWER

Question 16: Answer: False

and

Question 17: Answer: False

Array out of bounds, at most 3 numbers

Question 18: Answer: True

Question 19: Answer: True

i>0 repeats until less than or equal to 0, exits the loop

Change process i=5, i=3, i=1, i=-1.

Question 20: Answer: False

Array index: 0, 1, 2, 3, 4, and there is no arr[5].

Leave a Comment