The Art of Writing Short Stories Read Here

[Sumita Arora Textbook Solutions] CBSE Class 11 - Computer Science - Chapter 9 - Flow of Control

                               Flow Of Control

(Sumita Arora) Textbook Solutions 7th Edn

CBSE Class 11 - Computer Science with C++ - Ch1 - Computer Overview (Sumita Arora) Textbook Solutions
credits:openclipart

SHORT ANSWER QUESTIONS

Q1: What is null statement and a compound statement? What is the alternate name of the compound statement?

Answer: The simplest statement is null statement or empty statement. It is represented as just semicolon (;).

e.g. ; // null statement


A compound statement is a sequence of statements enclosed by pair of braces ({}). Alternate name of the compound statement is block.

Q2: What is the significance of a null statement?

Answer: A null statement is useful where the language requires a statement but the program's logic does not.


e.g.  a program keeps on reading a value till it encounters a particular value or end-of-file.
  
while (cin >> val && val != required_vale) 

            ; 

Q3: What are the three constructs that govern statement flow?


Answer: sequence, selection and iteration

Q4: What is the significance of a test-condition in a loop?

Answer: The test-condition in a loop decides whether the loop-body will be executed or not based on the truth value. If the test-condition evaluates to true i.e., 1, the loop-body will execute, otherwise the loop is terminated.

  • computer science problems and solutions
  • computer science sumita arora solutions class 11
  • computer science sumita arora solutions
  • ap computer science a solutions
  • ap computer science solutions manual
  • a+ computer science solutions
  • computer science c++ sumita arora solutions
  • computer science an overview solutions
  • computer science 2013 board solutions
  • class 12 computer science book solutions
  • brookshear computer science solutions
  • cbse class 9 computer science book solutions
  • computer science class 11 cbse book solutions
  • computer science solutions class 12
  • computer science ncert solutions class 9
  • computer science with c++ solutions
  • computer science class 11 cbse solutions
  • discrete mathematics for computer science solutions
  • together with computer science class 12 solutions download
  • discrete mathematics for computer science solutions manual
  • cs computer science gate-2012 detailed solutions .pdf
  • discrete structures for computer science solutions
  • discrete mathematics for computer science solutions pdf
  • computer science exercise solutions
  • ap computer science exam solutions
  • computer science illuminated 5th edition solutions
  • invitation to computer science exercise solutions
  • logic in computer science exercises solutions
  • computer science illuminated 4th edition solutions
  • computer science an overview 11th edition solutions
  • computer science an overview 11th edition solutions pdf
  • computer science an overview 10th edition solutions
  • computer science exams with solutions
  • cbse computer science solutions for class 9
  • computer science textbook solutions for class 11
  • ap computer science frq solutions
  • foundations of computer science forouzan solutions
  • mathematics for computer science solutions
  • foundations of computer science solutions
  • computer science gridworld solutions
Saikat Ghosh Architecture Aetwork Social Network LivingStyl Lifestyle Blog
Q5: What is a selection statement? Which selection statement does C++ provides?


Answer: The selection statement conditionally executes another statement (or block of statements) based on whether a specified expression is true. C++ provides two types of selection statements: if and switch.

Q6: Can a conditional operator replace an if statement always?

Answer: No in conditional operator usually replaces if statement but not always.

Q7: Correct the following code fragment:


if (x=1)
    k=100;
  else
 k=1O;
Answer: it should be if (x == 1)

Q8: What will be the output of the following code fragment?



cin >> a;
  if (a=5)
 cout << "Five";
  else
 cout << "Not Five";
 
  if the input given is (1)7 (ii)5?


Answer: (Note: Please see if (a=5) assigns 5 to a. An assignment operator is used instead of equality operator. That's why if (condition) is always true.)

 (1) Five

 (2) Five

Q9: What will be the output of the following code fragment?


int year;
  cin >> year;
  if (year%100 == 0)
 if(year%400 == 0)
  cout << "LEAP";
 else
  cout << "Not century year";
 
  if the input given is (i)2000 (ii)1900 (iii) 1971?
Answer:

          (i) LEAP

          (ii) Not century year
          
          (iii) No output

Q10: What will be the output of the following code fragment?



int year;
 cin >> year;
 if (year%100 == 0)
  { 
  if(year%400 == 0)
   cout << "LEAP";
  } 
 else
  cout << "Not century year";
 
 if the input given is (i)2000 (11)1900 (iii) 1971?
 


Answer: (i) LEAP

              (ii) No output

             (iii) Not century year
You may also like :