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) Logic errors cause an interrupt in the compilation process.
Mark the valid and invalid variable
names.
(yes) saved_yes
(no) low-level
Mark the syntax 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
names are variables of type int.
(yes) nik
+
1
(no) %beta
%
2
Mark the syntax correct and
incorrect arithmetic expressions.
All
symbolic names denote double
type variables.
(yes) s21
+
t20 / 5
(no) 2 *
t %
(t + 1
)
We have following variable definitions:
int
k = 2;
double x =
0.5;
Calculate the arithmetic expressions (using C++
syntax) and mark with "yes'' these, which have
value 10 (integer number) or 10.0 (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 value 9 (integer number) or 9.0 (floating point number).
(yes) a2/k
(no) a1
-
k
Mark the arithmetic expressions which have double
type of the result. 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 a string variable name.
The variable pname is
already defined and has a value "CDE".
(yes) string
name
= "Neli";
(no) string
name
= 19;
We have following variable definitions:
string
n = "XYZ";
string m =
"33";
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 graphical 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 a Message object.
(yes) cwin
<<
Point(-1, 1);
(no) cwin
<<
"Hello!";