Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Concepts Quiz

Total questions: 38

Worksheet time: 22mins

Name
Class
Date
1.

Which of the following expressions does not loop?

a)

If – Else

b)

While

c)

Do-While

d)

For

2.

Which expression is a valid assignment statement?

a)

If miles = gallons

b)

mpg = miles/gallons

c)

miles/gallons

d)

miles/gallons = mpg

3.

Which loop structure is used for an unknown number of iterations?

a)

For

b)

While

c)

If

d)

If-else

4.

What is the result of INTEGER DIVISION for 13 divided by 5?

a)

2

b)

2.3

c)

3

d)

2.6

5.

What is a loop within a loop or an IF within an IF?

a)

Terminal

b)

Invalid

c)

Nested

d)

Infinite

6.

Which of the following is an example of input?

a)

Sound is played when program starts

b)

Button is displayed on window

c)

User types their name using the keyboard

d)

Instructions are displayed on the screen

7.

When varNum = 9, how does the expression (varNum > 7) evaluate?

a)

FALSE

b)

TRUE

c)

Invalid

d)

Zero

8.

If the variables daylistHoliday and daylistWeekend are both false, what is displayed as a result of the program?

a)

Holiday

b)

Weekend

c)

Neither

d)

Both

9.

What will be displayed if the day is a weekend?

a)

Nothing is displayed

b)

Take some time to have fun

c)

Have a great weekend

d)

You got to go to school

10.

To avoid an infinite loop, what must the code include?

a)

Way to meet the exit condition

b)

At least 5 statements within the block

c)

Way to print the result to the screen

d)

Descriptive source code comments

11.

Which expression is invalid code?

a)

2*(5+3)

b)

2(5+3)

c)

2 * 5+3

d)

(2*5) +3

12.

Which of the following stores a value that cannot be changed?

a)

Variable

b)

Function

c)

Methods

d)

Constant

13.

Why would a function be used?

a)

Encrypt the data

b)

Increase the length of the program

c)

Reuse the same code

d)

Add comments

14.

What is the first step of the software development life cycle?

a)

Test the output

b)

Analyze the project specifications

c)

Write the code for the parts that you know

d)

Write the main function

15.

What does this code produce? X = 10 WHILE (X < 10) { x = x – 1 DISPLAY(x) }

a)

9 8 7 6 5 4 3 2 1

b)

Loop does not execute

c)

1 2 3 4 5 6 7 8 9

d)

Creates an infinite loop

16.

Which situation is considered ethical?

a)

Giving proper credit to pre-existing code

b)

Using copyrighted code

c)

Using pre-existing code and calling it your own

17.

Which expression is true?

a)

5<6AND5>7

b)

5<6AND5>2

c)

5<6AND5>=8

d)

5.=6AND5<8

18.

What is the result of this expression 5*(3-2)?

a)

15

b)

10

c)

5

d)

13

19.

Which expression increments the variable (adds 1)?

a)

a+a=1

b)

a+1=a

c)

a=a+1

d)

a=a-1

20.

What is the result of 11 MOD 37?

a)

3.33

b)

3.667

c)

3

d)

2

21.

Which expression is true?

a)

2>5 OR 6<=8

b)

6<5 OR 6=8

c)

5>=6 OR 6<5

d)

5<2 OR 5>=8

22.

What is the result of this expression 6 + 3 /3?

a)

7

b)

6

c)

0

d)

3

23.

What does the following code DISPLAY? age = 19 IF (age>=18) { DISPLAY (“You can vote.”) } ELSE IF (age >+ 16) { DISPLAY(“You can drive.”) } ELSE { DISPLAY(“You are too young to drive or vote.”) }

a)

You can drive

b)

You can vote

c)

You can vote. You can drive

d)

You are too young to drive or vote

24.

What must be done before a variable can be used?

a)

Displayed

b)

Declared

c)

Printed

d)

Executed

25.

Which is the assignment operator?

a)

= +

b)

=

c)

>=

d)

<=

26.

What is the process of fixing an error in a program?

a)

Debugging

b)

Commenting

c)

Formatting

d)

Linking

27.

Which of the following is a valid identifier?

a)

2milesdriven

b)

$milesDriven

c)

miles driven

d)

milesDriven

28.

Which of the following is not a career field in computer programming software design?

a)

Database Programmer

b)

Network Administrator

c)

Game Developer

d)

Software Engineer

29.

What is the value of the variable sum after the following code?

sum=10

IF(sum>10)

{

Sum=sum+5

}

ELSE

{

Sum=sum-6

}

a)

10

b)

15

c)

5

d)

20

30.

What is the result of the code segment?

a)

Number = 5

b)

Number = 0

c)

Number = 6

d)

Infinite loop

31.

Which of the following might be declared as a constant?

a)

Annual amount of rainfall in Utah

b)

Size of the student body at your school

c)

Distance between the sun and the moon

d)

Number of inches in a foot

32.

Which of the following would LEAST likely be found in a software?

a)

Write code

b)

Program solution

c)

Install cables

d)

Design application

33.

What is coding?

a)

Creating design documentation

b)

Documentation on how to run a program

c)

Typing a program in a computer language

d)

Analyzing data types

34.

What is the first step of the software development life cycle?

a)

Test the output

b)

Analyze the project specifications

c)

Write the code for the parts that you know

d)

Write the main function

35.

Why would a function be used?

a)

Encrypt the data

b)

Increase the length of the program

c)

Reuse the same code

d)

Add comments

36.

What is the correct way to write a while loop?

a)

while {

b)

while.true {

c)

while (loop)

d)

while True:

37.
Which type of looping structure is guaranteed to execute at least one time?
a)
While Loop
b)
Do While Loop
c)
For Loop
d)
None of these
38.
Which of the following clauses should not be used in  looping structure under normal circumstances?
a)
for
b)
while
c)
continue
d)
do