WorksheetsProgramming Concepts Quiz
Total questions: 38
Worksheet time: 22mins
Which of the following expressions does not loop?
If – Else
While
Do-While
For
Which expression is a valid assignment statement?
If miles = gallons
mpg = miles/gallons
miles/gallons
miles/gallons = mpg
Which loop structure is used for an unknown number of iterations?
For
While
If
If-else
What is the result of INTEGER DIVISION for 13 divided by 5?
2
2.3
3
2.6
What is a loop within a loop or an IF within an IF?
Terminal
Invalid
Nested
Infinite
Which of the following is an example of input?
Sound is played when program starts
Button is displayed on window
User types their name using the keyboard
Instructions are displayed on the screen
When varNum = 9, how does the expression (varNum > 7) evaluate?
FALSE
TRUE
Invalid
Zero
If the variables daylistHoliday and daylistWeekend are both false, what is displayed as a result of the program?
Holiday
Weekend
Neither
Both
What will be displayed if the day is a weekend?
Nothing is displayed
Take some time to have fun
Have a great weekend
You got to go to school
To avoid an infinite loop, what must the code include?
Way to meet the exit condition
At least 5 statements within the block
Way to print the result to the screen
Descriptive source code comments
Which expression is invalid code?
2*(5+3)
2(5+3)
2 * 5+3
(2*5) +3
Which of the following stores a value that cannot be changed?
Variable
Function
Methods
Constant
Why would a function be used?
Encrypt the data
Increase the length of the program
Reuse the same code
Add comments
What is the first step of the software development life cycle?
Test the output
Analyze the project specifications
Write the code for the parts that you know
Write the main function
What does this code produce? X = 10 WHILE (X < 10) { x = x – 1 DISPLAY(x) }
9 8 7 6 5 4 3 2 1
Loop does not execute
1 2 3 4 5 6 7 8 9
Creates an infinite loop
Which situation is considered ethical?
Giving proper credit to pre-existing code
Using copyrighted code
Using pre-existing code and calling it your own
Which expression is true?
5<6AND5>7
5<6AND5>2
5<6AND5>=8
5.=6AND5<8
What is the result of this expression 5*(3-2)?
15
10
5
13
Which expression increments the variable (adds 1)?
a+a=1
a+1=a
a=a+1
a=a-1
What is the result of 11 MOD 37?
3.33
3.667
3
2
Which expression is true?
2>5 OR 6<=8
6<5 OR 6=8
5>=6 OR 6<5
5<2 OR 5>=8
What is the result of this expression 6 + 3 /3?
7
6
0
3
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.”) }
You can drive
You can vote
You can vote. You can drive
You are too young to drive or vote
What must be done before a variable can be used?
Displayed
Declared
Printed
Executed
Which is the assignment operator?
= +
=
>=
<=
What is the process of fixing an error in a program?
Debugging
Commenting
Formatting
Linking
Which of the following is a valid identifier?
2milesdriven
$milesDriven
miles driven
milesDriven
Which of the following is not a career field in computer programming software design?
Database Programmer
Network Administrator
Game Developer
Software Engineer
What is the value of the variable sum after the following code?
sum=10
IF(sum>10)
{
Sum=sum+5
}
ELSE
{
Sum=sum-6
}
10
15
5
20
What is the result of the code segment?
Number = 5
Number = 0
Number = 6
Infinite loop
Which of the following might be declared as a constant?
Annual amount of rainfall in Utah
Size of the student body at your school
Distance between the sun and the moon
Number of inches in a foot
Which of the following would LEAST likely be found in a software?
Write code
Program solution
Install cables
Design application
What is coding?
Creating design documentation
Documentation on how to run a program
Typing a program in a computer language
Analyzing data types
What is the first step of the software development life cycle?
Test the output
Analyze the project specifications
Write the code for the parts that you know
Write the main function
Why would a function be used?
Encrypt the data
Increase the length of the program
Reuse the same code
Add comments
What is the correct way to write a while loop?
while {
while.true {
while (loop)
while True:
