wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Comp Sci. Examination March 13th

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

What is the purpose of using a for loop in code?

a)

To repeat something a fixed number of times

b)

To do something if a condition is true

c)

To do something while a condition is true

d)

To make programs run faster

2.

What is top down design?

a)

Top down design is a way that you can create designs on a computer to put on a web page

b)

Top down design is a way of designing your programs starting with the individual commands first

c)

Top down design is a way to use loops and if statements to decompose the problem

d)

Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.

3.

Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?

a)

If statement

b)

While loop

c)

Nested while loop

d)

For loop

4.

How can we teach Karel new commands?

a)

For loop

b)

While loop

c)

The start function

d)

Define a new function

5.

Why does a programmer indent their code?

a)

Helps show the structure of the code.

b)

Easier for other people to understand.

c)

A key part of good programming style!

d)

All of the above

6.

What condition should be used in this while loop to get Karel to pick up all the tennis balls on the current location?

**********************************************************************************************************************

while (________) {

takeBall();

}

a)

noBallsPresent()

b)

frontIsClear()

c)

takeBall()

d)

ballsPresent()

7.

What does the mystery function do?

***********************************************************************************************************************

function mystery() {

while (noBallsPresent()) {

move();

}

}

a)

Karel checks if there is no ball on the current spot and then moves once

b)

Karel moves until it puts down a ball

c)

Karel moves once if there is no ball present

d)

Karel moves until it is on a ball

8.

Which of the following is the correct way to define a turnRight function in Karel?

a)

turnRight function() { turnLeft(); turnLeft(); turnLeft(); }

b)

function turnRight { turnLeft(); turnLeft(); turnLeft(); }

c)

function turnRight() { turnRight(); turnRight(); turnRight(); }

d)

function turnRight() { turnLeft(); turnLeft(); turnLeft(); }

9.

What does Binary mean?

a)

Of 1 state

b)

Of 3 states

c)

Of 4 states

d)

Of 2 states

10.

Who is the type of algebra used to create logical statements named after?

a)

Albert Einstein

b)

Bill Gates

c)

Steve Jobs

d)

George Boole

11.

What is the only condition that will cause an OR statement to register as false?

a)

One part is true

b)

Both parts are true

c)

One part is false

d)

Both parts are false

12.

What is pseudocode?

a)

A programming language used to create computer applications

b)

A set of instructions written in a programming language

c)

Natural language expressions that describe what you want a program to do

13.

Why would you choose to use a "for" loop instead of a "conditional" loop?

a)

When you want the code in the loop to repeat until a value of an input sensor changes.

b)

When you want the code in the loop to repeat until a condition changes.

c)

When you want the code in the loop to repeat until a button is pressed.

d)

When you want the code in the loop to repeat a specific number of times.

14.

A group of functions is called...

a)

a system

b)

a routine

c)

a repository

d)

a library

15.

The part of the computer that would was called the Computer Generator.  They were basically the first _____ ____.

a)

type writer

b)

dot matrix

c)

display screen

d)

graphics card

16.

Early computers did not use pixels to display images on the a screen because they would take up to much ________.

a)

Lines

b)

Dots

c)

Pixels

d)

Memory

17.

What were the 2 ways early computers could display images on a screen.

a)

Line Scanning and

Pixel Scanning

b)

Shape Scanning and 

Dot Scanning

c)

Vector Scanning and 

Raster Scanning

18.

What three coordinate directions make up 3D graphics?

a)

a, b, c

b)

w, x, y

c)

h, i , j

d)

x, y , z

19.

Objects hidden behind other objects is called_______

a)

conclusion

b)

inclusion

c)

re-shaping

d)

occlusion

20.

CPU’s aren’t designed for this, so they aren’t particularly fast. So, computer engineers created special processors just for graphics called ___________________

a)

Circuit Board

b)

Chips

c)

Central Unit

d)

Graphics Processing Unit

21.

Which statement will correctly call a JavaScript function?

a)

myFunction()

b)

initiate myFunction()

c)

call myFunction()

d)

var myFunction()

22.

Which JavaScript statement should you use to branch to one of two processes

depending on the result of a test condition?

a)

if...else

b)

break

c)

for

d)

do...while

23.

Which JavaScript code is used to define a function?

a)

define myFunc { return value; }

b)

define myFunc() { }

c)

abra kadabra () { }

d)

function myFunc() { }

24.
What syntax follows after an if statement?
a)
parenthesis
b)
curly braces
c)
a colon
d)
square brackets
25.

In JavaScript, which of the following items allows you to store user-entered or

developer-defined data and use it more than once?

a)

Operator

b)

Keyword

c)

Concatenation

d)

Variable

26.
A user-defined name for a memory location whose value can change over time.
a)
variable
b)
syntax
c)
operator
d)
token
27.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
28.

Which of the following is the correct Javascript format for a comment?

a)

// "the text"

b)

/"the text"/

c)

*/"the text"/*

d)

\\"the text

29.
What character do we use for multiplication?
a)
#
b)
x
c)
*
d)
/
30.

What will print to the console?

a)

Time to buy!

b)

Time to wait for a sale.

c)

sale

d)

Nothing, there is a syntax error on the fourth line

31.

What will print to the console?

a)

Time to buy!

b)

Time to wait for a sale.

c)

sale

d)

Nothing, there is a syntax error on the fourth line

32.

Which correctly matches the logical operator with its syntax?

a)

and - !

or - | |

not - &&

b)

and - &&

or - | |

not - !

c)

and - | |

or - !

not - &&

d)

and - &&

or - !

not - | |

33.

For this conditional to be true....

a)

day must be equal to Saturday and Sunday

b)

day must be not equal to Saturday or Sunday

c)

day must be equal to Saturday or Sunday

34.
Comparison Operators
What is >= ?
a)
Greater than
b)
Less than
c)
Greater than or equal to
d)
Less than or equal to
35.

Based on the code below what is answer equal to?

let x =20;

let y= 8;

let answer= x % y  

a)

4

b)

2

c)

12

d)

28

36.

What Javascript code matches this statement:

The score is not 0

a)

if (score != 0)

b)

if (score =! 0)

c)

if (score not 0)

d)

if (score !! 0)

37.

Which line of code could be used to make this image.

a)

rectangle(20, 20, 150, 100);

b)

rect(20, 20, 20, 20)

c)

rect(20, 20, 150, 100);

d)

ellipse(20, 20, 150, 100);

38.

Find the bug! Why is the rectangle not red?

a)

The parameters in line 1 are incorrect.

b)

The fill code should come first.

c)

There is no background code.

d)

There is no stroke code.

39.

Look at the line of code. What does the number 173 represent?

a)

the x coordinate of the circle

b)

the width of the circle

c)

the y coordinate of the circle

d)

the height of the circle

40.

Which command is used to print messages on the console in JavaScript.

a)

print()

b)

js.write()

c)

console.log()

d)

console.write()

41.

Complete the code to type in your favorite weather:

​ (a)   ​ (b)   = ​ (c)   ("What is your favorite type of weather?")

Choose from the below words
let
weather
prompt
alert
document.writeln
42.

What is the value of x at the end of the code?

var i;

var x=0;

for(i =0; i<10; i++){

x++;

}

a)

10

b)

11

c)

9

d)

12

43.

What type of variable is apple?

var apple = " Fuji "

a)

string

b)

Boolean

c)

array

d)

number

44.

Which command is written incorrectly?

a)

putBall();

b)

putball();

c)

turnLeft();

d)

takeBall();

45.

What is printed to the screen if the user enters ‘5’ when the following program is run?

var userNum = readInt("Enter your favorite number: ");

var calculatedNum = (userNum * userNum) + userNum;

println(calculatedNum);

a)

5

b)

25

c)

30

d)

50

46.

Why do programmers use variables?

a)

Because they are lazy and don’t want to write out equations every time

b)

It allows the programmer to reuse multiple lines of code

c)

They are a way to document functions

d)

To store values to easily reuse later and make code easier to read and understand

47.

Which code would correctly have Karel move to and pick up BOTH balls?

a)
b)
c)
d)
48.

Which code correctly has Karel jump both Hurdles and reach the end of the 1st street to the right?

a)
b)
c)
d)
49.

What would be the resulting world if the following code ran in the starting world shown?

a)
b)
c)
d)
50.

You need to write a program that has Karel take all the tennis balls where Karel is standing.

Karel should end up with no tennis balls on that spot.

Which control structure do you need to use?

a)

FOR loop

b)

WHILE loop

c)

IF statement

d)

IF/ELSE statement

e)

None of the above