0% found this document useful (0 votes)
45 views

Assignment (8) MultipleChoiceQues

The document contains 20 multiple choice questions about C++ concepts such as variable types, operators, loops, arrays, and functions. It tests knowledge of basic syntax rules and language features including variable declaration and initialization, arithmetic operators, conditional and looping statements, arrays, functions, and input/output.

Uploaded by

Kyaw Zin Lynn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Assignment (8) MultipleChoiceQues

The document contains 20 multiple choice questions about C++ concepts such as variable types, operators, loops, arrays, and functions. It tests knowledge of basic syntax rules and language features including variable declaration and initialization, arithmetic operators, conditional and looping statements, arrays, functions, and input/output.

Uploaded by

Kyaw Zin Lynn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment (8) Multiple Choice Questions

1.The maximum value that an integer constant can have is

(a) -32767

(b) +32767

(c) 65535

(d) None of the above

2. Which of the following is not a correct variable type?


(a) float
(b) real
(c) int
(d) double

3. Which of the following statement is wrong?


(a) Z= X + Y;
(b) X= 12.5;
(c) X + Y = Z;
(d) Ch=‘z’;

4. In C++, variable names must begin with

(a) #
(b) $
(c) Number
(d) Letter

5. Which header file must be included to use the functions pow( ) and sqrt( )?
(a) #include<iostream.h>
(b) #include<stdio.h>
(c) #include<conio.h>
(d) #include<math.h>

6. What is the correct answer of a?


int a=10;
a+=10;
cout<<a;
(a) 11
(b) 10
(c) 20

7. What is the output of 'ch2'?


char ch1='e',ch2;
ch2 = toupper(ch1);
cout<<ch2;
Ans: E
8. What is the value of ‘s’?
int p=4,q=3,
s=pow(q,p);
cout<<s;
(a) 64
(b) 46
(c) 81
(d) None of the above

9. What is the output of the following C++ code?


void main()
{
int i;
for(i=0;i<5;i++)
{
cout<<"$ "
}
cout<<”A”;
}
(a) $A$A$A$A$A
(b) SASASASASA
(c) $$$$$A
(d) A$$$$$

10. Single line comment is written after


(a) */
(b) /*
(c) //

11. If a=5, b=++a then the value of a and b is


(a) 6 and 6
(b) 5 and 6
(c) 6 and 5

12. What is the output of the following statement?


cout << " Welcome to \n" ;
cout << " MMMC "<<endl ;
Ans:
Welcome to
MMMC
13.What will be the output of the following C++ code?
#include<iostream>
void main()
{
int x =5, y =5;
cout<<++x <<”,”<<--y <<endl;
}

(a) 5,5
(b) 6,4
(c) 4,6
(d) 4,5

14. What is the output of the following?


for(int i=1; i<15; i=i+3)
cout<< i;

(a) 15
(b) 1471013
(c) 147101316

15. What is correct syntax of for loop?

(a) for(increment/decrement; initialization; condition)


(b) for(initialization, condition, increment/decrement)
(c) for(initialization;condition; increment/decrement)
(d) None of These

16. What is the output of the following C++ code?


int x=1;
while(x<5)
{
x++;
cout<x;
}
(a) 234
(b) 2345
(c) None of the above

17. Given the following code, what is the value of the variable x?
int fun[5] = {3, 2, 5, 7, 32, 0};
int x = fun[3];
(a) 5
(b) 7
(c) 0
(d) None of the above
18. Which of the following is correctly declares an array?

(a) int array;


(b) int array[10];
(c) array{10};
(d) array array[10];

19. What is the output of the following C++ code?


for(i=1;i<=6;i++)
prod=1*i;
cout<<prod;
(a) 6
(b) 120
(c) 720
(d) None of the above

20. What is the output of the following C++ code?

int num={15,37,42,68,54, 65,77, 80};

cout<<num[0];

(a) 0
(b) 15
(c) 80
(d) None of the above

You might also like