The questions of Test 1
with two possible
answers - one correct (yes) and one incorrect (no)
Mark the correct and incorrect assertions about
computers and programming.
(yes) The primary RAM storage loses all its data when the power is
turned off.
(no) The hard disk storage loses all its data when the power is
turned
off.
Mark the valid and invalid variable names.
(yes) sale
(no) that-name
Mark the correct and incorrect variable definition statements.
(yes) int
pen = 8;
(no) pennies
= 3;
Mark the correct and incorrect input and output statements.
Suppose that all variables are defined and initialized properly.
(yes) cout
<< "C++\n";
(no) cout
>> k;
Mark the correct and incorrect assignment statements.
The variables k, count
and n have int
type;
the variables total
and x have double
type;
the variables sub and s have string
type.
(yes) k =
k + 1;
(no) int
n = x * 100;
Mark the syntax correct and incorrect arithmetic expressions.
All variables have int
type.
(yes) h +
1
(no) %h -
2
Mark the syntax correct and incorrect arithmetic expressions.
All variables have double
type.
(yes) s +
t20 / 2
(no) s %
t + 1
We have the following variable definitions:
int k = 2;
double x =
0.5;
Calculate the arithmetic expressions and mark with "yes'' these,
which have values 10 (as an integer number or a floating point number).
(yes) 20
* x
(no) 8
* x + k
We have the following variable definitions:
int a1 = 21;
int a2 = 81;
int k = 9;
Calculate the arithmetic expressions and mark with "yes'' these,
which have values 9 (as an integer number or a floating point number).
(yes) a2/k
(no) a1
- k
Mark the arithmetic expressions which have double
type of the result.
The following variable definitions are given:
int j = 25;
double z =
3.75;
(yes) z +
j/2
(no) j%4
+ 121
Mark the correct definitions of the string variable name.
The variable pname is
defined and has a value "ABCDEF".
(yes) string
name = "Ivan";
(no) string
name = 5;
We have the following variable definitions:
string n = "123";
string m =
"ABCD";
Mark the syntax correct and incorrect statements.
(yes) cout
<< n.substr(0,2);
(no) cout
<< length(m);
Mark the correct and incorrect statements about the class Time
and the object t of
this class.
(yes) Time
day_begin(0,0,1);
(no) cout
<< t.get_minutes(t);
Mark the correct and incorrect statements about the class Employee
and the object harry of
this class.
(yes) harry.set_salary(4000);
(no) cin
>> harry.set_salary();
We have the following graphics objects definitions:
Point p(3,2), q(3,3);
Circle c(p,
1); Line l(p,q);
Message
m(p,"Hello!");
Mark the statements in which these objects and member-functions from
graphics classes are used correctly.
(yes) double
px = p.get_x();
(no) get_x();
Mark the valid and invalid statements about the graphics window. m is an object from Message
class.
(yes) cwin
<< Point(-1, 1);
(no) cwin
<< "Hello!";