NEW
Font size
Worksheetsввп,
Total questions: 35
Worksheet time: 18mins
Which of the following operators is used for input in C++?
abs
cin
sqrt
cos
cout
the value 25.17 can be represented using which data type?
integer
bool
double
void
What type of statement is cin >> number;?
output statement
input statement
declaration of variable
The value 12.5 can be represented using what type of data?
float
integer
bool
void
In C++, this statement terminates the loop when it is encountered?
continue
break
&&
What is an array?
An array is a series of elements of the same type placed in non-contiguous memory locations
An array is a series of elements of the same type in contiguous memory locations
None of the mentioned
An array is a series of element
Which of the following statements is true?
The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.
The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a.
The variable a and the variable b are equal.
The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a.
Which of the following is selection statement in C++?
int
bool
do
cin
switch
Elements in Two-Dimensional arrays are accessed using ______.
the row indexes and column indexes
the column indexes
the type of element
the row indexes
This statement breaks one iteration (in the loop), if a specified condition occurs
continue
&&
break
the general form of declaring a two-dimensional array?
array_name[size1][size2];
data_type array_name[number of rows][number of columns];
data_type array_name[size];
array_name data_type[a][b];
Which of the following is the correct operator to compare two variables?
Equal
+=
||
&&
==
Which is NOT a loop structure in C++?
do while
repeat until
for
do
Looping in a program means...
to repeat the specified lines of code
jumping to the specified branch of program
All of them
How many times the current loop will execute: for (int i = 1; i <= 4; i += 3);?
2
3
4
1
0
Which should be included to work with files?
cmath
string
fstream
Which of the following properly declares a variable var of structure foo?
foo var;
intstruct foo;
var foo strust;
Struct foo;
What is structure?
a group of data elements together with some name.
a group of data elements grouped together under two names.
a set of some elements grouped together under value.
a group of data elements grouped together under one name.
How many elements does this two-dimensional array have: int arraytwo[3][4];?
12
7
0
4
3
______ is used to insert characters in string at specified position.
insert()
cin
getline()
cout
Observe the following function declaration and choose the best answer: int divide (int a, int b = 2)
Variable a and b are of int type and the initial value of both variables is 2
Variable b will have value 2 if not specified when calling function
Variable b is international scope and will have value 2
Variable b is of integer type and will always have value 2
The return type of the function prototype float func(char x, float v, double t); is:
int
float
double
char
string
Why do we need fstream class?
To work with files.
To work with mathematical functions.
To work with strings.
What will be used when terminating a structure?
Brackets
Dot
Semicolon
Colon
Write the correct function definition, where function 'alua' that takes three integers, x, y and z, and returns an integer?
double alua(int x, int y, int z)
intfunct (int x, int y, int z)
char alua(int x, int y, int z)
int alua (int x, int y, int z)
By default, all the files are opened in __________ mode.
binary
text
Which of the following gives the memory address of a pointer a?
*a;
a[0];
&a;
address(a);
We declare a function with ______ if it does not have any return type.
void
int
float
double
bool
Choose the right option:
string* x; string y;
x is a pointer to a string, y is a string
y is a pointer to a string, x is a string
both x and y are pointer to string types
The return type of the function prototype int func(char x, float v, double t); is:
int
float
bool
double
char
What value will be in the variable b after executing the following code: b = 5; a = b++;?
4
6
0
5
3
Which stream class is used to both read and write on files?
ifstream
iostream
ofstream
fstream
Pointers may be compared by using relational operators.
False
True
What is the correct value to return to the operating system upon the successful completion of a program?
-1
20
10
0
1
What is the difference between array and structure?
Arrays can include only integers
Structure can include members of different data types
No difference
