The questions of Test_1
with two model
answers - one correct (yes) and one incorrect (no)
Mark the correct and incorrect assertions about
computers and programming.
(yes) Assembler is processor dependent low-level language.
(no) CPU can read data from ROM and can write data back to it.
Mark the valid and invalid variable
names.
(yes) saved_yes
(no) low-level
Mark the correct and incorrect variable
definition statements.
(yes) int
p = 22;
(no) dimes
= 1;
Mark the correct and incorrect input
and output statements.
Suppose that all variables used in the expressions, are defined and
initialized properly.
(yes) cout
<< "Hello\n";
(no) cout
>> dimes;
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 =
2*n + 3;
(no) int
n = x * 100;
Mark the syntax correct and
incorrect arithmetic expressions.
All variables have int
type.
(yes) nik
+
1
(no) %beta
% 2
Mark the syntax correct and
incorrect arithmetic expressions.
All variables have double
type.
(yes) s21
+
t20 / 5
(no) 2 *
t %
(t + 1
)
We have the following variable definitions:
int k = 2;
double x =
0.5;
Calculate the arithmetic expressions (using C++
syntax) 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 (using C++ syntax) 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/10
(no) j%4
+ 121
Mark the correct definitions
of the string variable name.
The variable pname is
already defined and has a value "ABCDEF".
(yes) string
name = "Neli";
(no) string
name = 19;
We have the following variable definitions:
string n = "987";
string m =
"ABCZ";
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 already defined object t of
this class.
(yes) Time
end_day(1,0,1);
(no) cout
<< t.get_hours(t);
Mark the correct and incorrect statements about the class Employee
and already
defined object harry of
this class.
(yes) harry.set_salary(400);
(no) cin
>> harry.set_salary();
We have the following graphics objects definitions:
Point p(3,2), q(4,3);
Circle c(p,
2);
Line l(p,q);
Message
m(p,"Hello!");
Mark with "yes'' 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. Let m be an
object from Message
class.
(yes) cwin
<< Point(-1, 1);
(no) cwin
<< "Hello!";