assignment5classXI

ASSIGNMENT5

(FOR LOOP,SWITCH..CASE,IF..ELSE..,WHILE LOOP)  


QUESTIONS AND ANSWERS
Q1.
char inchar = 'A';
switch (inchar)
{
case 'A' :
    cout<<"choice A n";
case 'B' :
    cout<<"choice B ";
case 'C' :
case 'D' :
case 'E' :
default:
    cout<<"No Choice";
}
Q2.
void main()
{
    int i = 3;
    switch(i)
    {
       
        case 1: cout<<"INDIA";
            break;
        case 2: cout<<"Quiz";
            break;
        default: cout<<"INDIAQuiz";
    }
cout<<"Outside ";

}
Q3.
 var i = 0;
while (i < 3)
 {
    cout<<"hi";
    i++;
}
cout<<"bye";
(a)hi(b)hi(c)hi
byebye
hi



hi

hi




bye

bye




hi






bye



Q4.
var x = 3;
var i = 0;
while (i < 3) {
  x += 1;
  i += 1;
}
cout<<x;
What does the code output?
(a) 7    (b)  3    (c)   4    (d)  6

Q5.
var i = 3;
while (i < 6) {
  cout<<i<&lt" ";
  i += 1;
}
What does the code output?
(a) 3 4 5 6     (b)  1  2  3     (c)  3  4  5

Q6.
var i = 0;
while (i < 3) {
  cout<<i<<" ";
  i++;
}
What does the code output?
(a)  1  2  3   (b)  0  1  2  3    (c)  0  1  2


Followers

Popular Posts

Recent Posts