wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

COMPROG

Total questions: 60

Worksheet time: 34mins

Name
Class
Date
1.

Fill in the blank: (a)   language is written in 0s and 1s and can be directly understood by the computer.

2.

Fill in the blank: The (a)   is where the programmer writes the code in a high-level programming language like C++.

3.

Fill in the blank: The (a)   translates the source code into an intermediate object code, which is closer to machine code but still not executable.

4.

What is the output of the following code? int a=10,b=5; int sum=a+b; cout<< sum;

a)

15

b)

10

c)

5

d)

20

5.

What will be the value of result in the expression int result = 5 + 2 * 3 - 4 / 2;

a)

9

b)

10

c)

11

d)

12

6.

What is the output of the following code? int myNum=15; myNum=10; cout<< myNum;

a)

15

b)

10

c)

0

d)

Error

7.

What is the output of the following code? cout<< "I am " << myAge << " years old.";

4 lines
8.

What is the output of the following code? int x = 5; int y = 10; bool answer = !(x > y);

a)

true

b)

false

9.

What is the output of the following code? int a=3; int b=4; int product=a*b; cout<< product;

a)

34

b)

7

c)

Error

d)

12

10.

What will be the value of total in the expression int total = (8 + 2) * (3 - 1);

a)

12

b)

20

c)

10

d)

16

11.

What is the output of the following code? int x = 10; int y = 5; bool result = (x <= y);

a)

false

b)

true

12.

What will be the value of total in the expression int total = 6 * (2 + 3) - 4;

a)

20

b)

30

c)

22

d)

26

13.

What is the output of the following code? int a = 8; int b = 3; bool answer = (a < b);

a)

true

b)

false

14.

What will be the value of result in the expression int result = (10 - 2) / 2 + 3 * 4;

a)

14

b)

20

c)

16

d)

18

15.

What is the output of the following code? int a = 7; int b = 2; bool result = (a != b);

a)

false

b)

true

16.

What will be the value of result in the expression int result = 4 * (3 + 1) / 2;

a)

8

b)

6

c)

10

d)

12

17.

What is the output of the following code? int x = 12; int y = 4; int division = x / y; cout << division;

a)

3

b)

6

c)

4

d)

2

18.

What are the 2 main types of software?

a)

System and Application

b)

Informational and Entertainment

c)

Dynamic and Static

d)

Professional and Home-based

19.

It is use to hold numbers, strings and complex data for manipulation

a)

Variables

b)

Character

c)

Integers

d)

Program

20.

A C program basically has the following form

a)

Preprocessor Commands

b)

Functions

c)

Variables

d)

Statements & Expressions

e)

Comments

21.
Syntax errors are always spotted when the program is compiled or interpreted.
a)
True
b)
False
22.
Logic errors are detected by the programming IDE being used.
a)
False
b)
True
23.
Syntax errors are caused by incorrectly typed source code.
a)
True
b)
False
24.
A program won't run if there is a logic error.
a)
False
b)
True
25.
Which statement best describes logic errors?
a)
An error in a program that causes it to produce incorrect ouputs but not a crash.
b)
An error in a program that causes it to crash.
c)
An error in the program caused by mis-spelt instructions.
d)
An error in a program caused by hardware failure.
26.
A program may never contain both syntax and logic errors.
a)
False
b)
True
27.

Which of this command has errors? Select multiple

a)

System.out.print("Hello World")

b)

System.out.print(Hello World);

c)

System.out.Print("Hello World);

d)

System.out.print("Hello World");

28.

System.out.print("5/0");


is an example of _________ error.

a)

syntax

b)

logic

c)

runtime

29.

System.out.print(5/0);


is an example of _________ error.

a)

syntax

b)

logic

c)

runtime

30.

What are the digits used in computer code?

a)

1,2,3,4,5,6,7,8,9

b)

0,1

c)

1,2

d)

0,2

31.

How many binary digits are contained in one byte?

a)

2

b)

1

c)

10

d)

8

32.

__________ is the software in a computer.

a)

Code

b)

CPU

c)

Byte

d)

Computer Science

33.

Which of the following careers is primarily involved in writing software?

a)

programmer

b)

security analyst

c)

software developer

d)

electrical engineer

34.

Which number system is used by computers?

a)

fractional

b)

roman

c)

decimal

d)

binary

35.

What does 'coding' mean?

a)

The method of compiling code into executable files.

b)

The process of writing instructions for computers using programming languages.

c)

The process of designing user interfaces.

d)

The act of debugging software errors.

36.

What is a programming language?

a)

A programming language is a formal language comprising a set of instructions that can be used to produce various kinds of output.

b)

A programming language is a style of painting.

c)

A programming language is a method of cooking.

d)

A programming language is a type of computer hardware.

37.

What is an algorithm?

a)

An algorithm is a step-by-step procedure for solving a problem.

b)

A type of computer hardware.

c)

A programming language used for coding.

d)

A random guess for a solution.

38.

What is a variable in programming?

a)

A variable is a fixed value that cannot change.

b)

A variable is a command that executes a program.

c)

A variable is a type of function in programming.

d)

A variable is a named storage location in memory that holds a value.

39.

the computer can decide the instruction like humans being, is that true?

a)

sure

b)

No, it can't

c)

very true

d)

not sure

40.

What is a loop in programming?

a)

A loop is a type of variable used in programming.

b)

A loop is a data structure that stores multiple values.

c)

A loop is a function that executes only once.

d)

A loop is a control structure that repeats a block of code as long as a specified condition is true.

41.

What is the purpose of a function?

a)

To display output to the user without any input.

b)

The purpose of a function is to encapsulate code for reuse and organization.

c)

To execute code only once during a program's lifecycle.

d)

To store data in a database permanently.

42.

What does 'syntax' mean in programming?

a)

Syntax is the meaning of the code in a programming language.

b)

Syntax is a type of programming language used for web development.

c)

Syntax is the set of rules that defines the structure of code in a programming language.

d)

Syntax refers to the speed of code execution.

43.

what is the meaning of flowchart?

a)

A compiler is used for scripting languages, while an interpreter is used for compiled languages.

b)

A compiler translates code into machine language, while an interpreter translates it into assembly language.

c)

it is a diagram that represents an algorithm and shows its steps.

d)

it executes the program directly, while an interpreter does not.

44.

Which of the following describes machine language?

a)

Is a high-level programming language

b)

Is machine-dependent and not portable

c)

Is easy for humans to read

d)

Uses English-like syntax

45.

What is a logical error in programming?

a)

An error in syntax

b)

An error that occurs at runtime

c)

An error that produces incorrect results

d)

An error that prevents the program from compiling

46.

The end of each C statement must be marked with a ________.

a)

colon

b)

semi-colon

c)

zero or 0

d)

0 with semi-colon

47.

int stands for what?

a)

interest

b)

interval

c)

integral

d)

integer

48.

A letter or symbol to which a some value can be assigned.

a)

Print

b)

Variable

c)

Output

d)

Bug

49.

Which symbol turns a code statement to a comment?

a)

$

b)

@

c)

!

d)

#

50.

Which is the operand expressed in the above arithmetic expression?

a)

Average

b)

/

c)

Num

51.

Which of the following numeric value is considered as a float number?

a)

-10

b)

2345678

c)

0.5

d)

-98765

52.

Which of the following is define below?

"A reference to a location in memory where the data is stored."

a)

High level language

b)

Low level language

c)

Variable

d)

Translator

53.

Which translator translates the whole program from a high-level language into machine code at once to generate an executable file which you can run?

a)

compiler

b)

interpreter

54.

Select all high level languages from the below list.

a)

Machine language

b)

Java

c)

C++

d)

Assembly language

55.

Which instruction is used in Python to display a statement such as "Hello my name is Arwa" on the screen?

a)

printout

b)

display

c)

print

d)

output

56.

is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions.

a)

Compiler

b)

Interpreter

c)

C++

d)

Program

57.

what is the file extension of c++ program?

(a)  

58.
Computers can solve any problem that can be computationally solved.
a)
TRUE
b)
FALSE
59.

Complete the code by typing the missing piece.

(a)  

60.

What would be the output of the given code?

a)

Option A

b)

Option B

c)

Option C

d)

Option D