Apply Object Oreinted Program Language

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Module Title: Applying OOP Language Skills Quiz Test

NAME ___________________________________ ID. No. _________________


I. chooses the correct answer for the following questions.
1. The modulus operator uses ___ character.
A. * B. % C. / D. +
2. In c , each statement ends with:
++

A. Colon B. point C. semicolon D. slash


3. How would you declare an integer called num and initialize it to 20?
A. int num=20; B. int num20; C. int num; num=20; D A
&C
4. What is the correct way to display integer sum to the screen?
A. cout<<sum<<endl;
B. cout<<"sum"<<endl;
C. cout>>sum>>endl;
D.cin>>sum>>endl;

5. How do you insert COMMENTS in C++ code?


A. // this is a multiple comment C. /* this is a multiple
B. # this is a multiple comment comment*/
D. None of the above
6. What is the output of the int main()
following program? A. 25
int main () { int a,b,c;
A. Hello B. 50
{ int x = 1; a = 10, b = 15;
B. Hi C. 20
switch(x) { a = 2 * a; b = 2 * b;
C. HelloHi D. 15
case 1 : c = a + b;
D. None of them cout << c;
cout << "Hi!" << return 0;
endl; }
break; 11. In which loop the condition is
default : checked after the execution of
cout << "Hello!" << statements?
endl; A. do..while B. while
} C. for
} 12. What will be the output of the
7. Compiler generates _______ file. following C++ code?
A. source code B. object int main()
code A. 0 1 2 3
C. text file D. none of {int i;
the above B. 4
8. Which statement is used to for (i = 0; i < 4; i++)
receive data from keyboard? C. 0 1 2 3 4
A. cout>> B. cin>> {
C. cin<< D. cout<< D. compiler error
9. What is the size of an int data cout << i<<” “;
type? }
A. 4 bytes B. 1 bytes return 0;}
C. 2 bytes D. 8 bytes }
10. What will be the output of the 13. Which one is not a loop?
following C++ code?
A. while B. for
C. do..while D. have
14. What loop needs a
semicolon?
A. while B. for
C. do..while D. have
Institution Name Document No.

ወ/ሮ ስህን ፖሊቴክኒክ ኮሌጅ OF/WSPC /263-01


W/R SIHEEN POLYTECHNIC COLLEGE
Title: Issue No. Page No.
2 Page 2 of 3
TTLM

You might also like