wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 4 Programming

Total questions: 88

Worksheet time: 2hrs 32mins

Name
Class
Date
1.
The equality operator is used to compare two values, and returns a Boolean (true/false). 
a)
=
b)
==
c)
<=
d)
>=<
2.
A precise sequence of instructions for processes that can be executed by a computer
a)
Abstraction
b)
Algorithm
c)
Aggregation
d)
ASCII
3.
In programming, an expression that evaluates to True or False. 

a)
Abstraction
b)
Boolean Expression
c)
Aggregate Expression
d)
None of the above
4.
A variable with local scope is one that can only be seen, used and updated by code within the same scope. Typically this means the variable was declared (created) inside a function -- includes function parameter variables. 
a)
Local variable
b)
Home variable
c)
Common variable
d)
Global variable
5.
Any sequence of characters between quotation marks (ex: "hello", "42", "this is a string!").
a)
Selection
b)
String
c)
Summary
d)
Protocol
6.
On-screen objects, like buttons, images, text boxes, pull down menus, screens and so on.
a)
UI Elements
b)
Type Elements
c)
Control Elements
d)
All of the above
7.

The visual elements of an program through which a user controls or communications the application.

a)

Unlimited Internet

b)

User Interface

c)

Universal Images

d)

User Images

8.
Dictates what portions of the code can "see" or use a variable, typically derived from where the variable was first created. (See Global v. Local)
a)
Variable Scope
b)
Variable View
c)
Variable Protocol
d)
Variable Interface
9.
A placeholder for a piece of information that can change.
a)
Table
b)
Variable
c)
Shelf
d)
Data
10.

What will be displayed if grade is set to 70?

a)

You passed!

b)

Time to start studying again!

c)

You passed! and Time to start studying again!

d)

Nothing will be displayed

11.

What is the output of the following JavaScript code segment?

a)

10

b)

error on str1 + str2: type mismatch

c)

55

d)

result

12.
An algorithm is..
a)
.. A set of instructions
b)
... A motion block
c)
... A character
d)
... A loop statement 
13.
A variable is used to:
a)
Store a value in memory
b)
Draw a circle
c)
Store a value that does not change
d)
Draw a rectangle
14.
Which are examples of operators?
a)
AND, OR and NOT
b)
Greater than (>), less than (<) and equal to (=)
c)
Multiplication (*), subtraction (-), addition (+) and division (/)
d)
Picking random numbers
15.
A _____ can hold letters and number
a)
Integer
b)
String 
16.

UI Elements include all of the following EXCEPT:

a)

Images

b)

Functions

c)

Pull Down Menus

d)

Text Boxes

17.

A syntax error in your code includes:

a)

A. - The program running correctly but not actually doing what you think it should do

b)

B. - A word you misspelled in a way the computer doesn't understand

c)

Both A and B

d)

Neither A or B

18.

Which of the following is FALSE with regards to the command console.log?

a)

You can use this command in sending messages to yourself to verify the program is doing what you think it's doing which helps prevent errors down the line.

b)

Using this command is a way to debug your program

c)

This command cannot be used in determining potential errors down the line in your programming

d)

Console.log is a way to display a simple plaintext output

19.

Trace the code, and choose the option that correctly shows what will be displayed.

a)

a = 12, b = 20, c = 32

b)

a = 12, b = 12, c = 12

c)

a = 4, b = 12, c = 16

d)

a = 12, b = 20, c = 24

20.

Look at the following:


var age = "20 + 5"


As a result of the above, using this variable throughout the remainder of this program would result in a value of 25.

a)

True

b)

False

21.

In the above picture, this would be an example of a:

a)

Local Variable

b)

Nested Variable

c)

Global Variable

d)

Variable Scope

22.

In the above picture, this would be an example of a:

a)

Local Variable

b)

Nested Variable

c)

Global Variable

d)

Variable Scope

23.

The following would be considered an example of a string:


'This is an example of a string'

a)

True

b)

False

24.

A logical error in your code includes:

a)

A. - The program running correctly but not actually doing what you think it should do

b)

B. - A word you misspelled in a way the computer doesn't understand

c)

Both A and B

d)

Neither A or B

25.

The visual elements of a program through which a user controls or communicates with the application. Often abbreviated UI.

a)

Callback Function

b)

User Interface

c)

Debugging

d)

Event Handler

26.

A function specified as part of an event listener; it is written by the programmer but called by the system as the result of an event trigger.

a)

UI

b)

Event Handler

c)

Callback Function

d)

Turtle

27.

A program designed to run blocks of code or functions in response to specified events (e.g. a mouse click)

a)

Event-driven Program

b)

Event Handler

c)

Beaver Programming

d)

Event Listener

28.

An action that causes something to happen.

a)

Debugger

b)

Data Type

c)

Variable

d)

Event

29.

All values in a programming language have a "type" - such as a Number, Boolean, or String - that dictates how the computer will interpret it.

a)

Data Type

b)

Variable

c)

Operation

d)

Bug

30.

Any valid unit of code that resolves to a value.

a)

Variable

b)

Expression

c)

Data

d)

Code

31.

The common programming structure that implements "conditional statements".

a)

"Maybe" Statement

b)

"When" Statement

c)

"If" Statement

d)

"Could" Statement

32.

Dictates what portions of the code can "see" or use a variable, typically derived from where the variable was first created.

a)

Variable Room

b)

Variable Travel

c)

Variable Space

d)

Variable Scope

33.

A variable whose scope is "global" to the program, it can be used and updated by any part of the code. Its global scope is typically derived from the variable being declared (created) outside of any function, object, or method.

a)

Global Variable

b)

Local Variable

c)

Wide Variable

d)

Limited Variable

34.

A variable with local scope is one that can only be seen, used and updated by code within the same scope. Typically this means the variable was declared (created) inside a function -- includes function parameter variables.

a)

Short Variable

b)

Small Variable

c)

Global Variable

d)

Local Variable

35.

Debugging

a)

Putting commands in correct order so computers can read the commands.

b)

a step-by-step procedure for solving a problem

c)

to write instructions for a computer.

d)

Finding and fixing problems in your algorithm or program.

36.

Which of the following would NOT be an acceptable ID when following the rules for naming IDs?

a)

A. thisWouldBeAcceptable

b)

B. This_Would_Be_Acceptable

c)

C. this-would-be-acceptable

d)

All three options would be acceptable IDs

37.

When naming IDs for your elements, they may NOT contain:

a)

Spaces

b)

Hyphens

c)

Underscores

d)

Periods

38.

When setting the setPosition command, the coordinates (0,0) begins where on the screen?

a)

Top Right Corner

b)

Bottom Left Corner

c)

Top Left Corner

d)

Bottom Right Corner

39.

The following line of code would not appear on the screen of an app you have just created:

console.log("Welcome to My App!");

a)

True

b)

False

40.

A player starts off a game with 3 lives (assigned by a variable named "lives"). After the player runs out of lives and the game is over, a "Play Again" button is pressed to start a new game. However, what needs to happen here?

a)

The following code should be added again: var lives = 3;

b)

The following code should be added to reset the lives: lives = 3;

c)

The following code should be added to reset the lives: reset lives = 3;

d)

No action needed; the game will automatically reset with 3 lives

41.

Which of the following is TRUE regarding = and ==

a)

When assigning a value to a variable, use ==

b)

The command if (count=20) is the correct way to type this command for this IF statement

c)

The command count = count-1; would be the correct way to update this variable each time you want it to decrease

d)

The correct way to start off with 3 lives would be typing this command first: var lives == 3;

42.

Once a value is assigned to a variable, it cannot be updated with a new value.

a)

True

b)

False

43.

Note the following line of code (note: Numlikes is a variable): write (So far + numLikes + people like this Quizizz); What will happen when this is ran?

a)

It will not run because the variable name does not follow proper naming rules

b)

It will not run because there are double quotation marks missing

c)

It will not run because the command "write" does not exist in Javascript

d)

The line would run perfectly: "So far ____ people like this Quizizz"

44.

When is a compound condition using the logic operator AND true?

a)

When either of the conditions are true

b)

When both of the conditions are false

c)

When both of the conditions are true

d)

When the NOT operator is also used

45.
Which are examples of Boolean operators?
a)
AND, OR and NOT
b)
Greater than (>), less than (<) and equal to (=)
c)
Multiplication (*), subtraction (-), addition (+) and division (/)
d)
Picking random numbers
46.
Which are examples of relational operators?
a)
AND, OR and NOT
b)
Greater than (>), less than (<) and equal to (=)
c)
Multiplication (*), subtraction (-), addition (+) and division (/)
d)
Picking random numbers
47.

Which of the following is FALSE regarding ELSE IF statements?

a)

You add an ELSE IF when you have another condition you want to check.

b)

You are limited to only one ELSE in your code

c)

Each condition in an ELSE IF is checked from top to bottom

d)

The final ELSE clause is executed if all the previous conditions evaluated to false.

48.

Which of the following statements regarding AND/OR operators are FALSE?

a)

true && true = true

b)

true && false = true

c)

false || true = true

d)

false || false = false

49.

Which of the following statements regarding AND/OR/NOT operators are TRUE?

a)

!(true) = true

b)

true || true = false

c)

false && true = true

d)

false || true = true

50.

Based on the following, determine whether each expression is TRUE or FALSE


var season= “Spring”;


!(season== “Summer”)

a)

True

b)

False

51.

Based on the following, determine whether each expression is TRUE or FALSE


var season= “Spring”;


!(3 > 2)

a)

True

b)

False

52.

Based on the following, determine whether each expression is TRUE or FALSE


var score= 80;


(score != 90) && (score > 70)

a)

True

b)

False

53.

Based on the following, determine whether each expression is TRUE or FALSE


var score= 80;


(score > 90) && (score < 100)

a)

True

b)

False

54.

Based on the following, determine whether each expression is TRUE or FALSE


var month = “March”;


(month == “Mar”) || (month== “March”)

a)

True

b)

False

55.

Based on the following, determine whether each expression is TRUE or FALSE


var month = “March”;


(month== “April”) || (10<12)

a)

True

b)

False

56.

Read the following line of code:


var statement = "Hello my name is " + firstName);


This would be considered an example of:

a)

concentrate

b)

concatenate

c)

conditional statement

d)

selection

57.

Which of the following would not be a correct way to use strings?

a)

"aString"

b)

"look at all these spaces"

c)

"$100 bills are the best"

d)

'myStringname'

58.

Looking at the image above, which of the following commands would you use as a text box you want the user to type into on a particular screen?

a)

Label

b)

Text Area

c)

Text Input

d)

Button

59.

In order to hold and retain the information obtained from the Name field, a variable should be used as follows:

a)

var userName = getText("nameInput");

b)

userName=textInput("nameInput");

c)

var userName=getText(nameInput);

d)

userName=textInput(nameInput);

60.

The "If" Statement is an example of a _________________

a)

Correctional Statement

b)

Competitive Statement

c)

Conditional Statement

d)

Inquisitive Statement

61.

True/False: The body of an "if" statement will only be executed if the condition is true.

a)

True

b)

False

62.

What is my result?

a)

John is getting ice cream

John is getting grapes

b)

John is getting apple juice

John is getting grapes

c)

John is getting apple juice

d)

John is getting ice cream

63.

What is my result?

a)

John is getting ice cream

John is getting grapes

b)

John is getting apple juice

John is getting grapes

c)

John is getting apple juice

d)

John is getting ice cream

64.

What is the result?

a)

You can buy some gum

b)

You are rich

c)

Get a job!

d)

You are rich

Get a job!

65.

With regards to IF ELSE Statements, either of the lines of code inside the IF will execute or the lines inside the ELSE will execute.

a)

True

b)

False

66.

With regards to IF ELSE Statements, ELSE shares it's opening and closing curly braces with the same curly braces from the IF portion of this statement

a)

True

b)

False

67.

Back in Lesson 8, you compared the user's password input to what we wanted the password to be. How would you write this in Javascript?

a)

if (textInput("password_input")=="my secret")

b)

if (getInput("password_input")=="my secret")

c)

if (password("password_input")=="my secret")

d)

if (getText("password_input")=="my secret")

68.

When creating an IF ELSE statement with multiple else if conditions, you should always start this statement with:

a)

ELSE

b)

IF ELSE

c)

ELSE IF

d)

IF

69.

When working with an IF ELSE statement, you can only have one possible else if condition in it.

a)

True

b)

False

70.

It is possible to write a chain of else-if conditions without a final else, in which case it's possible that the whole structure will be skipped.

a)

True

b)

False

71.

Decide if the expression evaluates to true or false:

a)

True

b)

False

72.

Decide if the expression evaluates to true or false:

a)

True

b)

False

73.

Decide if the expression evaluates to true or false:

a)

True

b)

False

74.

Decide if the expression evaluates to true or false:

a)

True

b)

False

75.

Decide if the expression evaluates to true or false:

a)

True

b)

False

76.

What will the value of "score" be at the end of this program?

a)

1

b)

The score is: 8

c)

8

d)

The score is: score

77.

What will be displayed after this code segment is ran?

a)

4

b)

8

c)

9

d)

13

78.

What is my result?

a)

John is getting ice cream

John is getting grapes

b)

John is getting apple juice

John is getting grapes

c)

John is getting apple juice

d)

John is getting ice cream

79.

What will be displayed after this code segment is run?

a)

Perfect Game!

b)

You Win!

c)

You Lose!

d)

Nothing Will Be Displayed

80.

The program above asks a user to type in a number and then will output a message. What number will a user need to input for the message "GREEN" to be displayed?

a)

10

b)

20

c)

30

d)

40

81.

Which of the following is FALSE with regards to variables?

a)

Numbers and strings are two different types of values

b)

Old values are deleted forever

c)

Expressions evaluate to multiple new values

d)

When variables are in the expression just make a copy, don’t change the actual variable

82.

"This" + "would" + "be" + "an" + "example" + "of" + "this":

a)

Expression

b)

Concatenation

c)

Single String

d)

Procedure

83.

Which of the following is TRUE regarding variables?

a)

It's advised to create them multiple times

b)

Variables should go at the bottom of your program code

c)

A variable name such as "myvariable" can have two words in the name

d)

Variables can never be created inside OnEvents or Functions

84.

Logical operators can include any of the following EXCEPT:

a)

&&

b)

==

c)

||

d)

!

85.

Which of the following is FALSE regarding Boolean expressions?

a)

A decision is made with the single Boolean value

b)

Boolean expressions can include Comparison Operators like <, >, <=, >=, ==

c)

Flowcharts can illustrate the steps of making a decision with a Boolean expression

d)

Each side of the Boolean expression is reduced to a single value

86.

These can check more than one Boolean expression. They will only run the code for the first Boolean expression that evaluates to true.

a)

IF-ELSE-IF Statements

b)

IF Statements

c)

IF-ELSE Statements

d)

All of these statements

87.

These add the functionality that if the condition is false it can still run some code before returning to running the program as normal

a)

IF-ELSE-IF Statements

b)

IF Statements

c)

IF-ELSE Statements

d)

All of these statements

88.

This checks if one Boolean expression is true. If it is, a piece of code is run. Otherwise the code runs as normally.

a)

IF-ELSE-IF Statements

b)

IF Statements

c)

IF-ELSE Statements

d)

All of these statements