wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSEC IT - 04 Loops & Trace Tables

Total questions: 50

Worksheet time: 42mins

Name
Class
Date
1.

Who might use a Trace-table?

a)

A computer programmer

b)

IT Technician

c)

Hardware engineer

d)

An artist

2.

What is the purpose of using a Trace table?

a)

Planning before writing a program

b)

To help debug a program

c)

Check for spelling mistakes

d)

Understand the program more

3.

In your trace table, you need a column for each v (a)   , and a column for your output.

4.

The trace table will contain two columns: (a)   and Output.

5.

The trace table will contain three columns: n, (a)   , and Output.

6.

This loop will repeat (a)   times

7.

What are logic errors?

a)

An error that does not stop the code from executing

b)

When the logic gates are incorrectly connected

c)

An error where the logic doesn't make sense

d)

Code that does not give the desired output

8.

Syntax error, Logic error or this code is perfect?

a)

Another great program, it is all ok

b)

Syntax error

c)

Logic error

9.

Which loop loops a set number of times?

a)

for

b)

while

c)

infinite

d)

loopy

10.

Repeating a task multiple times in programming is known as ?

a)

Iterators

b)

Scope

c)

Looping

11.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

The order in which instructions are carried out

c)

A decision point in a program

d)

Testing a program to make sure it works

12.

FOR loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

13.

Which type of loop iterates until instructed otherwise?

a)

FOR loop

b)

WHILE loop

14.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'A' be?

a)

1

b)

3

c)

5

d)

7

15.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'B' be?

a)

1

b)

3

c)

5

d)

7

16.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'C' be?

a)

1

b)

3

c)

8

d)

13

17.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'D' be?

a)

11

b)

13

c)

8

d)

1

18.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'E' be?

a)

3

b)

5

c)

8

d)

13

19.

Look at the Algorithm Below. In the corresponding Trace Table, what value should 'F' be?

a)

5

b)

8

c)

13

d)

18

20.

How many times will the following code print "Welcome to LIFE"?

int count = 0;

while (count < 10) 

{  System.out.println("Welcome to LIFE");  count++; }

a)

0

b)

8

c)

9

d)

10

21.

Which of these is the correct syntax for a loop?

a)

fore(integer i = 0; i>10; i++){}

b)

for(int i = 0; i<10; 1++){}

c)

for(int i = 0; i<10){}

d)

for(int i){}

22.

Which of the following is the correct way to create a String?

a)

String s = "I am cool";

b)

string string = i am cool;

c)

String s = I am cool

d)

String s = "I" am cool;

23.

What kind of construct is this?

a)

A count-controlled loop

b)

A condition controlled loop

c)

An infinite loop

d)

A decision

24.

 

What type of error is a bug in a program that causes it to operate incorrectly, but not to terminate or crash?

a)

Runtime errors

b)

Syntax errors

c)

Logic errors

d)

Memory errors

25.

What type of errors are mistakes in the way that the code is written?

a)

Runtime errors

b)

Syntax errors

c)

Logic errors

d)

Memory errors

26.

_______ operators are used to compare two values of the same type.

a)

Arithmetic

b)

Relational

c)

Logical

d)

Control

27.

A data value that does not change during the execution of a program is _____.

a)

Variable

b)

Constant

c)

Character

d)

Number

28.

It is possible to add maths into Scratch, what is the Scratch Key Word used for it?

a)

Operators

b)

Calculators

c)

Calculations

d)

Operations

29.
Which type of operator only returns the values true and false?
a)
Comparison
b)
Arithmetic
c)
Procedural
d)
Assignment
30.
Which data type contains only two values and is used to compare conditions?
a)
String
b)
Boolean
c)
Floating Point
d)
Integer
31.
What is the function of the <= operator?
a)
Greater than or equal to
b)
Less than or equal to
c)
Not equal to
d)
And equal 
32.
Besides the arithmetic operator, there are ___ other types of operators.
a)
5
b)
3
c)
4
d)
2
33.

_____________________ allows the computer to make a choice between alternative conditions.

a)

control structure

b)

sequence structure

c)

selection structure

d)

iteration structure

34.

Which of the following mean greater than or equal to?

a)

=<

b)

<=

c)

=>

d)

>=

35.

Select all logical operators listed

a)

!=

b)

==

c)

AND

d)

OR

36.

In the expression


A * B + ( C + D ) , what is computed first?

a)

A * B

b)

( C + D )

c)

B + ( C + D )

d)

None of the above

37.

Select ALL the relational operators

a)

>

b)

<

c)

%

d)

!=

38.

Which of the following means NOT equal to. Select ALL

a)

<>

b)

<<

c)

!=

d)

>>

39.

In order to control the program flow and to make decisions, we need to use the conditional operators and the logical operators together with the If...Then...Else control structure.

a)

True

b)

False

40.

Conditional Operators are also known as numerical comparison operators.

a)

True

b)

False

41.

The comparison in Conditional Operators will return a true or maybe result.

a)

True

b)

False

42.

Logical Operator And : One side or other must be true

a)

True

b)

False

43.

Logical Operator Or : Both sides must be true

a)

True

b)

False

44.

There are basically three types of If control structures.

a)

True

b)

False

45.

This is the simplest control structure which instructs the computer to perform a certain action specified by the Visual Basic 2013 expression if the condition is true.

a)

If Then Statement

b)

If Then Else Statement

c)

If Then ElseIf Statement

46.

This control structure will ask the computer to perform a certain action specified by the Visual Basic 2013 expression if the condition is met. And when the condition is false, an alternative action will be executed.

a)

If Then Statement

b)

If Then Else Statement

c)

If Then ElseIf Statement

47.

If there are more than two alternative choices, using just If…Then…Else statement will not be enough.

In order to provide more choices, we can use:

a)

If Then Statement

b)

If Then Else Statement

c)

If Then ElseIf Statement

48.

These type of devices make all the decisions in an electronic system.

a)

Input

b)

Process

c)

Output

49.

These type of devices receive and external signal.

a)

Input

b)

Process

c)

Output

50.

LEDs and lamps are examples of what type of device?

a)

Input

b)

Process

c)

Output