Computer Programming Using C++
Total points 41/51
Computer Programming Using C++
Programming and Algorithms Thematic Area
Email *
yonasalmayehu4421@[Link]
0 of 0 points
Input here your Student ID? *
14805/20
Select you section *
Regular (RD1CS1)
Regular (RD1CS2)
Regular (RD1CS3)
Extension
Write your Full Name? *
Yonas Alemayehu
Untitled Section 41 of 51 points
Which of the following loops is best when we know the number of *1/1
iterations?
While loop
Do While loop
for loop
If loop
Which of the following is “address of operator”?. * 1/1
&
[]
Identify the storage classes that have global visibility. * 1/1
Register Storage Class
Auto Storage Class
Extern Storage Class
StaticStorage Class
Under which pillar of OOPS does base class and derived class *1/1
relationship come?
Polymorphism
Inheritance
Encapsulation
Abstraction
Feedback
Base class and derived class relationship comes under inheritance.
Identify the scope resolution operator. * 1/1
::
>
Find the output of the following program. * 0/1
main(){
int a = 10 / 0;
}
Compiler Error
Exception
10
Correct answer
Exception
Feedback
Dividing integer by 0 gives arithmetic exception, since it is undefined.
By which of the following can the if-else statement be replaced? * 1/1
Bitwise Operators
Logical Operators
Conditional Operators
Artimatic Operators
Which of the following types is the language C++? * 1/1
Procedural
Statically typed language
Dynammically typed language
processed
Find the output of the following program. * 1/1
main(){
cout << -10 - 10 -10;
}
10
20
-30
Feedback
Since this is an arithmetic operation, -30 is the correct answer.
Find the output of the following program. * 1/1
main(){
int i = (1, 2, 3);
cout << i << endl;
}
Error
Feedback
The last value is given precedence. Hence, the output is 3.
Find the output of the following program. * 1/1
main(){
char ch[ ] = “Micro Exit Student.”;
int l = strlen(ch);
cout << l << endl;
}
18
19
20
21
Total types of constructors in C++ are? * 1/1
Feedback
There are three types of constructors in C++ - .default constructor, parameterized
constructor and copy constructor.
Identify the size of int datatype in C++. * 0/1
1 bytes
2 bytes
4 bytes
depends on compilers
Correct answer
depends on compilers
Data members and member functions of a class are private [Link]. * 1/1
True
False
Depends on the code
am not sure
Identify the correct function from which the execution of C++ program *1/1
starts?
new()
start()
pow()
main()
Identify the correct extension of the user-defined header file in C++. * 1/1
.cpp
.hg
.h
.hf
Feedback
.h extensions is the extension used for user-defined header files.
Identify the correct syntax for declaring arrays in C++. * 1/1
array arr[10]
array{10}
int arr[10]
int arr
The constants in C++ are also known as? * 0/1
pre-processor
literals
const
value
Correct answer
pre-processor
Choose the correct default return value of function. * 0/1
int
void
char
float
Correct answer
void
Find the output of the following program. * 0/1
main(){
Float a = 5;
switch(a){
Case 5: cout <<”Micro Exit Student.”;
Default: cout <<”Prepare”;
}
}
Micro Exit Student.
Prepare
Micro Exit Student. Prepare
Error
Correct answer
Error
Feedback
The following code will give error as we can pass either integer or character data type in
switch.
Identify the format string among the following. * 1/1
&
\n
%d
$
What is do-while loop also known as? * 0/1
Exit control
Entry Control
Pre tested
Post tested
Correct answer
Exit control
What is an object in c++? * 1/1
It is function of class
It is instance of class
It is data type of Class
It is part of syntax of class
Feedback
An object is an instance of class.
How much bytes of memory does void occupy? * 1/1
How many times will the print statement be executed? * 1/1
main(){
int i = 0;
label:
cout << “ Micro Exit Student. ;
i++;
if(i < 3){
goto label;
}
}
1 times
2 times
3 times
Erros
Feedback
Micro Exit Student. will be printed 3 times, since for every if i < 3, it goes to label and an
iteration occurs.
Identify the incorrect constructor type. * 1/1
Friend
Copy
Parameterized
Default
Feedback
Friend constructor is not a type of constructor.
C++ uses which approach? * 0/1
Right-Left
Top-Down
Left-Right
Bottoum-Up
Correct answer
Bottoum-Up
Feedback
C++ is an object oriented language and it uses bottom-up approach.
What does a C++ class hold? * 1/1
Function
Data
arrays
all
Both Data and arrays
Identify the correct definition of ‘*’ operator in pointer. * 1/1
Address of Operator
Value of Address operator
Multiplication Operator
Nothing Operator
Choose the option below which is not a member of class. * 1/1
Friend Function
Static Function
Vitual Function
Const Function
Using which of the following keywords can an exception be generated? * 1/1
threw
throws
throw
catch
Total types of errors in C++. * 0/1
Correct answer
Feedback
There are three types of errors in C++- syntax errors, runtime errors, logic errors.
Choose the correct subscript operator. * 1/1
[]
{}
()
What is the number of parameters that a default constructor requires? * 1/1
Feedback
Default constructor does not require any parameter.
When can an inline function be expanded? * 1/1
Run time
Compile Time
Never gets expanded
everytime
Which of the following data type is supported in C++ but not in C? * 1/1
Int
Bool
Double
Float
Using which of the following data type can 19.54 be represented? * 1/1
int
void
dobule
float
Identify the correct example for a pre-increment operator. * 1/1
++n
n++
- -n
+n
Identify the logical AND operator. * 1/1
||
&&
&
Feedback
Size of int = 2 byte, char = 1 byte and float = 4 bytes. Therefore total size = 2 + 1 + 4 = 7
bytes.
Find the output of the following program. * 1/1
main(){
int a, b = 10;
a = 95 / 10;
cout << a << endl;
9.5
10
9.0
Feedback
Since integer division is performed, 9 is the answer.
Which of the following is the correct identifier? * 1/1
2var_name
2VAR_NAME
$varname
var_Name12
Feedback
var_name12 is the correct identifier as in identifiers, it can contain lowercase/uppercase
letters or digits. It should start with non digits and also should not contain any special
characters.
Identify the correct escape sequence used for the new line. * 1/1
\t
\n
\a
\s
Feedback
\n is the escape sequence used for the new line.
Which of the following functions can be inherited from base class? * 0/1
Constructor
Destructor
Static
None
Correct answer
None
Feedback
None of the functions can be inherited from the base class.
Choose the size of the below struct. * 0/1
Struct{
Int a;
Char b;
Float c;
}
10
Correct answer
Feedback
Size of int = 2 byte, char = 1 byte and float = 4 bytes. Therefore total size = 2 + 1 + 4 = 7
bytes.
Which of the following is not a type of inheritance? * 1/1
Multiple
Multilevel
Distributed
Heirarchical
Feedback
Distributed is not a type of inheritance.
Why are comments used? * 1/1
Make the program run faster
To help others read and understand the program
To increase the sie of executable program
Make the program complile easier
Choose the correct option which is mandatory in a function. * 1/1
return_type
Parameters
Function name
Both Parameters and Function name
Identify the correct range of signed char. * 1/1
-256 to 255
-128 to 127
0 to 255
0 to 127
goto can be classified into? * 1/1
lable
Variable
operator
function
Find the output of the following program. * 1/1
main(){
int a = 10, b, c;
b = a++;
c = a;
cout << a << “ “ <<b <<” “<< c << endl;
10 11 11
11 11 11
11 10 11
10 10 10
Feedback
The initial value of a is 10. Now, after post incrementing, the value of a is 11, and the
previous value of a is assigned to b. Hence b = 10. c is assigned the updated value. Hence,
the answer is 11 10 11.
What is the ASCII value of ‘\0’ character? * 1/1
32
24
48
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy
Forms