WorksheetsCOMPROG
Total questions: 60
Worksheet time: 34mins
Fill in the blank: (a) language is written in 0s and 1s and can be directly understood by the computer.
Fill in the blank: The (a) is where the programmer writes the code in a high-level programming language like C++.
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.
What is the output of the following code? int a=10,b=5; int sum=a+b; cout<< sum;
15
10
5
20
What will be the value of result in the expression int result = 5 + 2 * 3 - 4 / 2;
9
10
11
12
What is the output of the following code? int myNum=15; myNum=10; cout<< myNum;
15
10
0
Error
What is the output of the following code? cout<< "I am " << myAge << " years old.";
What is the output of the following code? int x = 5; int y = 10; bool answer = !(x > y);
true
false
What is the output of the following code? int a=3; int b=4; int product=a*b; cout<< product;
34
7
Error
12
What will be the value of total in the expression int total = (8 + 2) * (3 - 1);
12
20
10
16
What is the output of the following code? int x = 10; int y = 5; bool result = (x <= y);
false
true
What will be the value of total in the expression int total = 6 * (2 + 3) - 4;
20
30
22
26
What is the output of the following code? int a = 8; int b = 3; bool answer = (a < b);
true
false
What will be the value of result in the expression int result = (10 - 2) / 2 + 3 * 4;
14
20
16
18
What is the output of the following code? int a = 7; int b = 2; bool result = (a != b);
false
true
What will be the value of result in the expression int result = 4 * (3 + 1) / 2;
8
6
10
12
What is the output of the following code? int x = 12; int y = 4; int division = x / y; cout << division;
3
6
4
2
What are the 2 main types of software?
System and Application
Informational and Entertainment
Dynamic and Static
Professional and Home-based
It is use to hold numbers, strings and complex data for manipulation
Variables
Character
Integers
Program
A C program basically has the following form
Preprocessor Commands
Functions
Variables
Statements & Expressions
Comments
Which of this command has errors? Select multiple
System.out.print("Hello World")
System.out.print(Hello World);
System.out.Print("Hello World);
System.out.print("Hello World");
System.out.print("5/0");
is an example of _________ error.
syntax
logic
runtime
System.out.print(5/0);
is an example of _________ error.
syntax
logic
runtime
What are the digits used in computer code?
1,2,3,4,5,6,7,8,9
0,1
1,2
0,2
How many binary digits are contained in one byte?
2
1
10
8
__________ is the software in a computer.
Code
CPU
Byte
Computer Science
Which of the following careers is primarily involved in writing software?
programmer
security analyst
software developer
electrical engineer
Which number system is used by computers?
fractional
roman
decimal
binary
What does 'coding' mean?
The method of compiling code into executable files.
The process of writing instructions for computers using programming languages.
The process of designing user interfaces.
The act of debugging software errors.
What is a programming language?
A programming language is a formal language comprising a set of instructions that can be used to produce various kinds of output.
A programming language is a style of painting.
A programming language is a method of cooking.
A programming language is a type of computer hardware.
What is an algorithm?
An algorithm is a step-by-step procedure for solving a problem.
A type of computer hardware.
A programming language used for coding.
A random guess for a solution.
What is a variable in programming?
A variable is a fixed value that cannot change.
A variable is a command that executes a program.
A variable is a type of function in programming.
A variable is a named storage location in memory that holds a value.
the computer can decide the instruction like humans being, is that true?
sure
No, it can't
very true
not sure
What is a loop in programming?
A loop is a type of variable used in programming.
A loop is a data structure that stores multiple values.
A loop is a function that executes only once.
A loop is a control structure that repeats a block of code as long as a specified condition is true.
What is the purpose of a function?
To display output to the user without any input.
The purpose of a function is to encapsulate code for reuse and organization.
To execute code only once during a program's lifecycle.
To store data in a database permanently.
What does 'syntax' mean in programming?
Syntax is the meaning of the code in a programming language.
Syntax is a type of programming language used for web development.
Syntax is the set of rules that defines the structure of code in a programming language.
Syntax refers to the speed of code execution.
what is the meaning of flowchart?
A compiler is used for scripting languages, while an interpreter is used for compiled languages.
A compiler translates code into machine language, while an interpreter translates it into assembly language.
it is a diagram that represents an algorithm and shows its steps.
it executes the program directly, while an interpreter does not.
Which of the following describes machine language?
Is a high-level programming language
Is machine-dependent and not portable
Is easy for humans to read
Uses English-like syntax
What is a logical error in programming?
An error in syntax
An error that occurs at runtime
An error that produces incorrect results
An error that prevents the program from compiling
The end of each C statement must be marked with a ________.
colon
semi-colon
zero or 0
0 with semi-colon
int stands for what?
interest
interval
integral
integer
A letter or symbol to which a some value can be assigned.
Variable
Output
Bug
Which symbol turns a code statement to a comment?
$
@
!
#
Which is the operand expressed in the above arithmetic expression?
Average
/
Num
Which of the following numeric value is considered as a float number?
-10
2345678
0.5
-98765
Which of the following is define below?
"A reference to a location in memory where the data is stored."
High level language
Low level language
Variable
Translator
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?
compiler
interpreter
Select all high level languages from the below list.
Machine language
Java
C++
Assembly language
Which instruction is used in Python to display a statement such as "Hello my name is Arwa" on the screen?
printout
display
output
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.
Compiler
Interpreter
C++
Program
what is the file extension of c++ program?
(a)
Complete the code by typing the missing piece.
(a)
What would be the output of the given code?
Option A
Option B
Option C
Option D
