NEW
Font size
WorksheetsDaniyal
Total questions: 45
Worksheet time: 11hrs 10mins
Specify the types of operator
Logical, Bitwise, Arithmetic, Relational
Mathematical, Bitwise, Arithmetic, Relational
Assignment, Bitwise, Arithmetic, Relational
Logical, Bitwise, Assignment, Relational
Logical operators always evaluated from
Left to right
No difference
Not sure
Right to left
When an equation uses more than one type of operator then the order of precedence has to be established with the different types of operators
Comparison, logical, arithmetic
Arithmetic, comparison, logical
Logical, arithmetic, comparison
Arithmetic, logical, comparison
Precedence for Logical Operators
OR, AND, NOT
OR, NOT, AND
NOT, AND, OR
AND, OR, NOT
What is an array?
An array is a series of elements of the different type placed in contiguous memory locations that can be individually referenced by adding an index to a unique.
An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier
An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by multiplying an index to a unique identifier.
An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a same identifier.
Find the arithmetic operator
x
+
+y
&x
5+9*3*3-4 > 10 (2+16-8/4 > 6 || (2<6 10>11))
True
False
How many times the current loop will execute? for (int i = 0; i <= 5; i += 3);
2 times
3 times
Never
5 times
There are two different ways to implement multi selections in C++ language. They are
Else – if and switch case
If… else and switch case
Else if
Not sure
The whole array can be passed to a function. However, it can't be changed by the code in that function.
True
Nothing
All of them
False
A two-dimensional array represents data in the form of table with rows and columns
Nothing
True
False
All of them
Which statement of array is true?
Int foo[5]={10,20,30};
Int foo[]{10,20,30};
Int foo[3]={10,20,30};
Int foo[];
What are strings?
Strings are objects that represent sequences of characters
Strings are objects that represent sequences of pointers
Strings are objects that represent sequences of special words
Strings are objects that represent sequences of structures
In which data type we write text
String
Int
Float
double
Choose the right syntax to define a function
name [parameter1, parameter2]
type (parameters)
parameter1, parameter2(name)
type name(parameter1, parameter2)
A function can return more than one value
True
False
What are the three steps in using a function?
Definition, invocation, argument.
Prototype, argument, signature.
Definition, prototype, invocation.
The factorial function.
if(n-1){return n*factorial(n-1);} else {return 1;}
n!=n*(n+1)!
n!=n-(n-1)! And 1!=1
n!=n/(n-1)! And 1!=1
Write mpg() function prototype, that takes two type double arguments and returns a double
Float mpg(int a){ float b = 1; return b;}
Void mpg(){}
Double mpg(double a, double b)
Double mpg(int a, double b)
What is data structure?
is a group of data elements grouped together under one name.
is a group of data elements grouped together under two names.
is a set of some elements grouped together under value.
is a group of data elements together with some name.
Which of the following are themselves a collection of different data types?
String
Structure
Char
Integer
The data elements in structure are also known as what?
Objects
Data
Members
None of the above
What will be used when terminating a structure?
Brackets
Colon
Semicolon
Dot
Which of the following is address of operator represented by?
$
#
&
@
Pointers may be compared by using relational operators
True
False
What will be used between the object name and the member name?
Dot
Semicolon
Colon
Anything
Which stream class is used to both read and write on files?
Ifstream
Ofstream
Iostream
Fstream
Which stream class is only used to read files?
Ifstream
Ofstream
Iostream
Fstream
Which of the following shows the correct syntax for if statement?
If expression
If(expression)
If{expression}
Expression if
When does the code block following while(x<100) execute?
While it wishes
When x is less than one hundred
When x is greater than one hundred
When x is equal to one hundred
Which of the following properly declares struct?
struct {int a;}
struct a_struct {int a;}
struct a_struct int a;
struct a_struct {int a;};
Which of the following properly declares a variable of struct foo?
struct foo;
foo var;
foo;
int foo;
Which of the following correctly declares an array?
int anarray[10];
int anarray;
anarray{10};
array anarray[10];
What is the difference between array and structure?
Only on their declaration
No difference
Structure can include members of different data types
Arrays can include only integers
There is an array with 29 elements, what is the index number of the last array element?
29
0
28
Array does not have element’s index
What will output from the following program
Hello will print three times
Hello will print once
Hello will print not be printed three times
Compile error
How many times the current loop will execute for (int i = 0; i <= 4; i += 3);?
2 times
3 times
5 times
infinitely
How many times the current loop will execute<xmp>for (int i = 0; i <= 10; i++);</xmp>?
11 times
Never
10 times
0
What is the output from the following program code
10 10 10 10 10
11 11 11 11 11
10
0 1 2 3 4
What is the output from the following program
3^4 is 81
3^4 is 80
3^4 is 12
43
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)
int alua(int x, int y, int z)
intalua(int x, int y)
intfunct(int x, int y, int z)
Write correct function prototype for the function ‘intToDouble’ that takes an integer argument ‘number’, and returns a double value.
double intToDouble(int number);
float intToDouble(int number);
double intToDouble(double number);
intintToDouble(number);
The OR (||) operator:
Has higher precedence that AND (&&) operator
Stops evaluation upon finding one condition to be true
Associates from right to left
True if all conditions are true
Which of the following for headers is not valid for C++ code?
for (int i = 0; i<9; i++)
for (int i = 0; i<8; i++)
for (integer i =0; j<10; i++);
for (int i = 0; i<7; i++)
Which conversion is not possible?
int to float
float to int
char to float
All are possible
