NEW
Font size
WorksheetsCSC126_Exercise1
Total questions: 20
Worksheet time: 11mins
All the following statements are valid declaration and initialization of PIE with 3.142 EXCEPT ______.
#define PIE = 3.142;
#define PIE 3.142
const float PIE = 3.142;
float PIE = 3.142;
The rule of any programming languages are its ______.
library
syntax
semantics
structure
Supposed a string “Hello Kitty” is to be stored in variable cName. What is the most suitable data type for the variable declaration?
char cName;
int cName;
float cName;
string cName;
All of the following identifiers are invalid EXCEPT ______.
RM10
WEH 5832
Hello!
3cent
What is the only language that a computer can directly understand?
C++
Java
Assemble Language
Machine Language
The user has entered wrong data type during the execution of the program. This type of error is called as ______
syntax error
logic error
semantic error
runtime error
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;
logic
run-time
syntax
operator
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.
ii. In multiple-way selections, the Boolean expressions are checked in sequential order until the correct match is found.
iii. Multiple-way selection statements allow more than two selections.
iv. The last else at the end of the selection is executed when none of the Boolean
expressions checked earlier are true.
I and III only.
II and IV only.
I, III and IV only.
I, II, III and IV.
Which of the following expressions will be evaluated to TRUE?
5<8 && 8>=9
10 != 10
(12–10<10) && (!(15<5)
‘A’ == ‘a’
distanceToSchool = 10
What is the value of the variable?
Which picture can be best described as the principle of "algorithm"?
