wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

J277 Comp 2

Total questions: 114

Worksheet time: 3580secs

Name
Class
Date
1.

Draw the flow chart symbol for Process

2.

Draw the Flow chart symbol for Decision

3.

Draw the flow chart symbol for Sub Program

4.

Draw the flow chart symbol for Terminal

5.

Abstraction is:

a)

adding to a problem

b)

filtering out all irrelevant characteristics and unnecessary details

c)

finding characteristics

d)

looking for similarities

6.

Click all that applies. Abstraction:

a)

is a problem solving tool

b)

removes unimportant information

c)

adds important information

d)

simplifies a situation

e)

focuses on what is important

7.

Before we can abstract, we first need to decompose the problem.

a)

true

b)

false

8.

What is decomposition?

a)

Breaking down a complex problem or system into smaller, more manageable parts

b)

Adding detail to make a problem more complex

c)

When you ignore the unnecessary detail in a problem

9.

Why do we decompose a complex problem?

a)

To make it more difficult to solve

b)

To change the problem we have

c)

To make it easier to solve

10.

Which of these is an example of decomposition?

a)

Watching a mechanic repair a bicycle

b)

Looking at different bicycles for similarities between them

c)

Finding out how a bicycle works by looking in detail at the different parts that make up the bicycle

11.

Press keys in order to say MEOW.

a)

CABD

b)

ACDB

c)

ADCB

d)

CCDD

12.

an ordered sequence of instructions that perform a specific task

a)

An array

b)

An algorithm

c)

A barcode

d)

A boolean

13.

a series of variables of the same data type

a)

An array

b)

An algorithm

c)

A bitmap

d)

A byte

14.

a number expressed in a base-2 number system. With a value of either 0 or 1

a)

Boolean

b)

Byte

c)

Behavior

d)

Binary Number

15.

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

a)

1

b)

3

c)

5

d)

7

16.

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

a)

5

b)

8

c)

13

d)

18

17.

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

18.

What are the main Type(s) of Test Data?

a)

ERRONEOUS/ABNORMAL DATA and BOUNDARY DATA

b)

Normal Test Data only

c)

Boundary Data only

19.

In which of the following cases, binary search algorithm is used?​

a)

To search an element in an unordered list.​

b)

To search an element in a list of few elements.

c)

To search an element in any ordered list with large number of elements.​

20.

How does a binary search algorithm works?​

a)

Dividing the list into halves until the item is matched with one in the list.​

b)

Starts with the first element and checks the next element consecutively until a match is found.

c)

​ None of the above​

21.

An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?​

a)

32

b)

16

c)

8

d)

5

22.

An array with 32 elements is input to a linear search algorithm. How many maximum number of comparisons are performed?​

a)

32

b)

16

c)

8

d)

5

23.

Complete the sentence: The lower half of the list is discarded if the value at midpoint is …………………….. item searched.​

a)

less than​

b)

greater than​

c)

equal to

24.

True or False: The upper half of the list is discarded if the value at midpoint is greater than item searched.​

a)

True

b)

​False​

25.
Which type of lists or data sets are linear searching algorithms used for?
a)
Unsorted lists or data sets
b)
Sorted lists or data sets
26.
A linear search is to be performed on the list:
12, 6, 8, 1, 3
How many searches would it take to find the number 1?
a)
1
b)
2
c)
3
d)
4
27.
How many linear searches will it take to find the value 7 in the list [1,4,8,7,10,28]?
a)
2
b)
3
c)
4
d)
5
28.

What is a Count-Controlled loop?

a)

for loop

b)

while loop

29.

A count controlled loop will..

a)

Repeat code until a condition is met

b)

Repeat code a specific amount of times

c)

Repeat code a random amount of times

d)

None of the above

30.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

31.

Which of these is NOT a loop in python?

a)

for loop

b)

while loop

c)

nested loop

d)

if loop

32.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

33.

What will be the output of this code?

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,2,4,6,8,10

c)

2,4,6,8,10,12

d)

2,4,6,8,10

34.

If i want to continuously check for a correct answer, what loop would i use?

a)

for loop

b)

while loop

35.

What is the error in this code?

a)

incorrect variable name

b)

incorrect indentation

c)

incorrect speech marks

d)

incorrect loop

36.
Arithmetic Operators
What is a % ?
a)
Multiplication
b)
Division
c)
Modulo
d)
Increment
37.

what is a string?

a)

any numeric value

b)

any float value

c)

any character value

d)

any special symbol value

38.

how we store string value in variable?

a)

'string'

b)

"string"

c)

%string%

d)

#sring#

39.

For string symbol + means........................

a)

addition

b)

swapp

c)

concatenation

d)

multiplication

40.

str1='101'

x=int(str1)

z=x+400

print(z)

a)

101400

b)

x400

c)

501

d)

none of above

41.

fruit1="kiwi"

fruit2="strawberry"

print(len(fruit1))

print(len(fruit2))

a)

kiwi and strawberry

b)

4

10

c)

4 10

d)

410

42.

slicing string X="BOnVoyage"

print X[0:5]

a)

BOnVoy

b)

BOnVo

c)

oyage

d)

bonvo

43.

Slicing string

x="BOnvoyage

print(x[4: ])

a)

BOnvo

b)

bonvo

c)

voyage

d)

VOYAGE

44.

python function

s=lower("INDIA)

print(s)

a)

India

b)

india

c)

INDIA

d)

INDIA

45.

Mode in the following program to open file for writing in a mode where new data will be added at the end of old data

file =open("poem.txt","__")

a)

r

b)

w

c)

a

d)

r+

46.

Choose the correct statement to close a file stream named myfile:

a)

myfile.terminate()

b)

myfile.end()

c)

myfile.close()

d)

myfile.remove()

47.

What will be the output-

f=open('abc.txt','a')

text="xyz"

f.write(text)

f.close()

a)

Writing into the file without erasing old content

b)

Writing into the file by erasing old content

c)

reading from the file without erasing old content

d)

reading from the file by erasing old content

48.

Which function is used to write multiple lines in text file?

a)

write()

b)

writelines()

c)

lines()

d)

print()

49.

filename="example.txt"

with open(filename, "w") as myfile:

myfile.write("Pershendetje")

What happens here?

a)

a file called 'example' is being read

b)

a file called 'example' is created and some text is saved in it.

c)

The text in the 'example' file is assigned to a variable

d)

a variable called filename is created and it's value is printed on a file

50.

Which statement is correct for adding the value 5 to a list called x?

a)

x.add(5)

b)

x.append(5)

c)

x.pop(5)

d)

x.insert(5)

51.

What does a range check do?

a)

Checks data across a range of numbers

b)

Checks the data is within an acceptable range

c)

Sorts numbers into ascending order

d)

Checks that the data is in the correct format

52.

What does a length check do?

a)

Checks the data entered is of the correct format

b)

Checks data has been entered

c)

Checks that data has the correct number of characters

d)

Checks data is within the correct range

53.

What is data validation?

a)

Checking that the data entered is wrong

b)

Checking that the data entered is correct

c)

Checking that the data entered is sensible or reasonable

54.
Which of the following isn't a method of improving maintainability in a program
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
55.
Which of the following explain key features of what a program does
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
56.
Which of the following gives suitable names to locations in memory
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
57.
Which of the following shows parts of selection and iteration more easily
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
58.
Could cause a sytnax error in your program if not done correctly
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
59.
Use of functions and procedures helps eliminate duplicate code
a)
True
b)
False
60.
Which of these describes maintainability
a)
Making the program easier to use for the user
b)
Making the code easier to read for the user
c)
Making the code easier to read for the programmer
d)
Making the program easier to use for the programmer
61.
In order to explain what you mean to another programmer, you use
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
62.
Why do programmers want code to be maintainable
a)
To make it easier to edit by other programmers
b)
To lessen the chances of mistakes being made
c)
To make it easier to make corrections and additions
d)
All of the above
63.

When is terminal testing carried out?

a)

Before you start

b)

At the end

c)

During the project

d)

After the design section

64.

Why is code indented?

a)

To group together a function

b)

The code may not use a { syntax and indentation is used instead

c)

To support code maintainability

d)

All of the above

65.

Which of these is not a feature of a test plan?

a)

The data entered

b)

The type of test data

c)

If the testing is terminal or iterative

d)

The expected outcome

e)

The result of the test

66.

When is a runtime error identified?

a)

After the program is executed

b)

Before a program runs

c)

While the program runs

67.

Which line contains a syntax error?

a)

print ("hello")

b)

print ("Hello")

c)

print ("hello)

d)

print ("HELLO")

68.

What is iterative testing?

a)

Testing completed after an error is found

b)

Random test on a computer program

c)

Tests completed as the program is being coded

d)

Tests which are planned

69.

When a program runs it asks the user to enter their first name. Which is an example of valid data?

a)

Mr Jones

b)

Sarah

c)

Sarah Jones

d)

Mrs Jones

70.

When a program runs it asks the user to enter their age. Which data would be most suitable to test for an incorrect piece of data being entered?

a)

44

b)

1

c)

97

d)

Forty Five

71.

The program below prints well done if the score is higher than 80:

if score < 80:

print ("Well done")

a)

Logic error

b)

Data error

c)

Text error

d)

Syntax error

72.

Which is not the name of a group of test data that you would use in a test plan?

a)

Valid data

b)

Range data

c)

Nil value data

d)

Average data

73.

What is the output of an OR gate if the inputs are 1 and 0?

a)

0

b)

1

c)

OFF

d)

2

74.

What is the output of an AND gate if the inputs are 1 and 0?

a)

0

b)

1

c)

ON

d)

2

75.

What is the output of a NOT gate if the input is 0?

a)

0

b)

1

c)

OFF

d)

2

76.

A NOT gate has...

a)

Two inputs and one output

b)

One input and one output

c)

One input and two outputs

d)

Two inputs and two outputs

77.

An OR gate has...

a)

Two inputs and one output

b)

One input and one output

c)

One input and two outputs

d)

Two inputs and two outputs

78.

The output of any logic gate can have either of two

a)

Gates

b)

States

c)

Inputs

d)

Outputs

79.

A logic state can only be....

a)

On or 1

b)

Off or 1

c)

1 or 0

d)

In and Out

80.

The output of a gate is only 1 when both inputs are 1

a)

OR

b)

NOT

c)

NAND

d)

AND

81.

A NAND gate is the combination of which two gates

a)

OR and AND

b)

AND and NOT

c)

NOT and OR

d)

OR and NAND

82.

Which of these is a definition of a transistor

a)

Microscopic devices that open and close circuits to communicate electrical signals.

b)

A device used to change a circuit

c)

A type of gate used in a CPU

d)

Circuit components which take several inputs

83.

State the output of the following circuit....

a)

0

b)

1

84.

State the output of the following circuit

a)

0

b)

1

85.
IDE stands for
a)
Intelligent Development Experience
b)
Integrated Development Experience
c)
Intelligent Development Environment
d)
Integrated Development Environment
86.
This feature of an IDE gives detail feedback of issues with your code
a)
Text Editor
b)
Stepping
c)
Error Diagnostics
d)
Interpreter
87.
This feature of debugging in an IDE offers the ability from the program to do what
a)
Text Editor
b)
Stepping
c)
Error Diagnostics
d)
Interpreter
88.
This feature of an IDE allows program code to be entered
a)
Text Editor
b)
Stepping
c)
Error Diagnostics
d)
Interpreter
89.
This feature of an IDE allows code to be executed / run
a)
Text Editor
b)
Stepping
c)
Error Diagnostics
d)
Interpreter
90.
This feature of an IDE suggests solutions to problems
a)
Text Editor
b)
Stepping
c)
Error Diagnostics
d)
Interpreter
91.
Debugging is the process of finding issues in your program code
a)
True
b)
FALSE
92.
This feature of an IDE allows you to check the contents of variables
a)
Breakpoints
b)
Watch Window
c)
Syntax Completion
d)
Colour Coding
93.
This feature of an IDE suggests or corrects code as it is entered
a)
Breakpoints
b)
Watch Window
c)
Syntax Completion
d)
Colour Coding
94.
This feature of an IDE highlights keywords for commands or variables
a)
Breakpoints
b)
Watch Window
c)
Syntax Completion
d)
Colour Coding
95.
This feature of an IDE allows you to stop/pause your program execution at a specific point
a)
Breakpoints
b)
Watch Window
c)
Syntax Completion
d)
Colour Coding
96.
IDEs usually have code translators so you can test your code
a)
True
b)
FALSE
97.
The text editor in the IDE is classed as a debugging tool
a)
True
b)
FALSE
98.
Error diagnostics in an IDE are classed as a debugging tool
a)
True
b)
FALSE
99.
The stepping feature of an IDE is classed as a debugging tool
a)
True
b)
FALSE
100.
Breakpoints in an IDE aren't classed as a debugging tool
a)
True
b)
FALSE
101.
Version control won't allow you to revert back to the very first version of your program made
a)
True
b)
FALSE
102.
Autoindent is an example of syntax completion
a)
True
b)
FALSE
103.
Autocorrect isn't an example of syntax completion
a)
True
b)
FALSE
104.
Colourcoding syntax and variables makes it harder to develop programs
a)
True
b)
FALSE
105.

Problem-based programming languages which are similar to natural languages

(a)  

106.

Problem-based programming languages which are short simple mnemonic commands

(a)  

107.

Code which is in a format a CPU can understand

(a)  

108.

Utility which converts high-level code into low-level code, one line at a time

(a)  

109.

Utility which converts high-level code into low-level code, whole blocks of code at a time

(a)  

110.

Utility which converts assembly code into low-level code

(a)  

111.

The part of an IDE where code is entered

(a)  

112.

Software feature used by developers to help detects bugs in the source code

(a)  

113.

Name for the utility which converts programming code into machine code

(a)  

114.

A process of debugging where code is executed one instruction or line at a time

(a)