CBSE Guess > Papers > Important Questions > Class XI > 2013 > Computer Science > Computer Science By Mr. Prabhuji Gupta
CBSE CLASS XI
Flow Of Control
Most Important Questions
Q 1 How will u find with a c++ program whether an entered year is a leap year?
Q 2 Write an equivalent while loop for the given for loop: for(int i=2,sum=0;i<=20;i+=2)
sum+=i;
Q 3 WAP to check if the given no. is a palindrome or not.
Q 4 WAP to reverse a no?
Q 5 WAP to compute cosine series
Q 6 What do u mean by ‘fall through’ in a switch construct?
Q 7 Why do we use the default clause in a switch statement?
Q 8 What is the significance of break in a switch statement?
Q 9 WAP to accept a decimal no.(0-63) and convert it into a 8 bit binary no.
Q 10 WAP to convert lower case characters in a string to uppercase?
Q 11 Write functions to return LCM and GCD of two no.s?
Q 12 What is an entry-controlled loop?
Q 13 What is an exit controlled loop?
Q 14 cond 1?cond 2?cond 3?exp 1:exp 2:exp 3:exp 4;
is equivalent to which of the following?
a) If cond 1 exp 1;
else if cond 2 exp 2;
else if cond 3 exp 3;
else exp 4;
b) If cond 1
if cond 2
if cond 3
exp 1;
else exp 2;
else exp 3;
else exp 4;
c) If cond 1 && cond 2 && cond 3
exp 1 |exp 2|exp 3|exp 4;
d) if cond 3
exp 1;
else if cond 2
exp 2;
else if cond 3
exp 3;
else
exp 4;
Q 15 Consider the following code snippet.
if (aNumber >= 0)
if (aNumber == 0)
cout<<”first string";
else cout<<”second string";
cout<<”third string";
1. What output do you think the code will produce if aNumber is 3?
2. Using only spaces and line breaks, reformat the code snippet to make the control flow easier to understand.
3. Use braces { and } to further clarify the code and reduce the possibility of errors by future maintainers of the code.
Q 16 WAP to print the following:
Q 17 WAP to print the following:
Q 18 WAP to print fibonacci series 0112358…..
Q 19 Write a code to print the following:
Submitted By Mr. Prabhuji Gupta
Email: [email protected] |