wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CSC126_Exercise1

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.
  1. All the following statements are valid declaration and initialization of PIE with 3.142 EXCEPT ______.

a)
  1. #define PIE = 3.142;

b)
  1. #define PIE 3.142

c)
  1. const float PIE = 3.142;

d)
  1. float PIE = 3.142;

2.
  1. The rule of any programming languages are its ______.

a)
  1. library

b)
  1. syntax

c)
  1. semantics

d)
  1. structure

3.
  1. Supposed a string “Hello Kitty” is to be stored in variable cName. What is the most suitable data type for the variable declaration?

a)
  1. char cName;

b)
  1. int cName;

c)
  1. float cName;

d)
  1. string cName;

4.
  1. All of the following identifiers are invalid EXCEPT ______.

a)
  1. RM10

b)
  1. WEH 5832

c)
  1. Hello!

d)
  1. 3cent

5.
  1. What is the only language that a computer can directly understand?

a)
  1. C++

b)
  1. Java

c)
  1. Assemble Language

d)
  1. Machine Language

6.
  1. The user has entered wrong data type during the execution of the program. This type of error is called as ______

a)
  1. syntax error

b)
  1. logic error

c)
  1. semantic error

d)
  1. runtime error

7.
  1. The following program segment produces an error when it is being compiled. The error is caused by:

float salary;
cout << “Please enter your current salary” ;
cin >> Salary;

a)
  1. logic

b)
  1. run-time

c)
  1. syntax

d)
  1. operator

8.

Identify statements about multiple-way selections that are TRUE.

i. If the first Boolean expression is true, the program will ignore the following else if.

  1. ii. In multiple-way selections, the Boolean expressions are checked in sequential order until the correct match is found.

  2. iii. Multiple-way selection statements allow more than two selections.

  3. iv. The last else at the end of the selection is executed when none of the Boolean

    expressions checked earlier are true.

a)
  1. I and III only.

b)
  1. II and IV only.

c)
  1. I, III and IV only.

d)
  1. I, II, III and IV.

9.
  1. Which of the following expressions will be evaluated to TRUE?

a)
  1. 5<8 && 8>=9

b)
  1. 10 != 10

c)
  1. (12–10<10) && (!(15<5)

d)
  1. ‘A’ == ‘a’

10.
What does this shape represent?
a)
Input/Output
b)
Decision
c)
Process
d)
Start/Stop
11.
What does this shape represent?
a)
Decission
b)
Process
c)
Input/Output
d)
Start/End
12.
What's missing ?
a)
On/Off
b)
Pink/Blue
c)
Hello/Goodbye
d)
Yes/No
13.
What command is this shape for?
a)
References another part of the program
b)
Data that is going in as input or coming out as output
c)
Processing something - a calculation or storing something into a variable
d)
Shows the direction of the program
14.
What is the correct definition of an algorithm?
a)
An algorithm is a step by step instructions to solve a problem.
b)
An algorithm is a process of baking bread.
c)
An algorithm is a software used to compute numbers.
d)
An algorithm is the process of breaking problems.
15.
What is the difference between a flowchart and pseudocode? 
a)
A flowchart is diagramatic whilst pseudocode is written in a programming language (eg. Pascal or Java) 
b)
A flowchart is textual but pseudocode is diagrammatic 
c)
A flowchart is a diagrammatic description of an algorithm whilst pseudocode is a textual description of an algorithm 
d)
A flowchart and pseudocode are the same thing 
16.
What is this ?
a)
Pseudocode
b)
Flow chart
c)
Syntax
17.
An identifier is the ‘name’ given to a variable. For example: 
distanceToSchool = 10
What is the value of the variable?
a)
10
b)
=
c)
distanceToSchool
18.

Which picture can be best described as the principle of "algorithm"?

a)
b)
c)
d)
19.
In the diagram shown, where is the error?
a)
A
b)
B
c)
C
d)
D
20.
What does this shape represent in flowchart?
a)
Input/Output
b)
Process
c)
Decision
d)
Start/Stop