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

ch2

The document covers control statements in C programming, including branching, looping, and jumping statements. It includes multiple-choice questions, fill-in-the-blanks, true/false questions, and short and long answer questions about various control structures like if-else, switch-case, for loop, while loop, and do-while loop. Additionally, it explains the differences between pre-test and post-test loops, and the purpose of jumping statements.

Uploaded by

arpansharma1321
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

ch2

The document covers control statements in C programming, including branching, looping, and jumping statements. It includes multiple-choice questions, fill-in-the-blanks, true/false questions, and short and long answer questions about various control structures like if-else, switch-case, for loop, while loop, and do-while loop. Additionally, it explains the differences between pre-test and post-test loops, and the purpose of jumping statements.

Uploaded by

arpansharma1321
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

12th Class Computer Science (Session 2023-24)

Chapter 2nd
Control Statements
Q:1 Objective Type Multiple Choice Questions:
1. Which of the following statement is also called as conditional statement?
a. for b. break c. if d. while
2. switch-case is similar to statement
a. if else b. if else if c. break d. goto
3. Which statement can be used to terminate a case in the switch statement?
a. continue b. goto c. if d. break
4. Which of the following is an example of Post Test loop?
a. for b. while c. do while d. continue
5. Which of the following is not a jumping statement?
a. while b. continue c. goto d. break

Q:2 Fill in the Blanks:


1. In loops, the control conditions are tested before the body of loop
2. In loops, the control conditions are tested after the body of loop
3. statement is used to skip some statements inside the loop
4. is a multi-way conditional control statement
5. The break statement can be used to terminate a case in the _ statement.
Ans: 1. Pre-Test 2. Post-Test 3. continue 4. Switch case 5. switch

Q:3 Write True or False


I. Writing if statement with-in another if is called Nested Loop.
II. Control statements in C programming are used for altering the normal flow of a program.
III. continue statement is sometimes desirable to skip some statements inside the loop?
IV. Looping statements provide a way to repeat commands?
Ans: I. False II. True III. True IV. True
Q:4 Short Answer Type Questions:
Q:1 Define Branching? Name its different control statements?
Ans: Those control statements which are used for decision making purpose or for making multi-way
selection in the program are called Branching Statements. These statements choose to follow one
branch or another during execution in the program. Branching statements are of the following two
types:
 Conditional Control Statements (if else)
 Multiway Conditional Control Statement (switch case)
Q:2 What is looping? Name three different types of looping statements?
Ans: Those control statements which are used to repeat a set of statements in the program are called
looping statements. Looping statements are also called Iterative Statements. Following three looping
statements are used in the C programming:
 for loop
 while loop
 do while loop
Q:3 What is nested if statement? Write its syntax?
Ans: When one if statement is used within another if statement, it is known as nested if statement.
Syntax of nested if statement is shown in the figure.

1|Page
12th Class Computer Science (Session 2023-24)
Q:4 What is if-else statement? Write a program of if-else statement?
Ans: if else statement is a branching statement. It is used for decision making purpose in the C
programs. Following program shows the usage of if else statement:

Q:5 What is while statement? Write its syntax?


Ans: while statement is a looping statement. It is used for repeating set of statements in the program.
It is a type of pre-test loop in which test condition is tested before the execution of body of the loop.
The syntax of the while statement is shown in the given figure.

Q:5 Long Answer Type Questions:


Q:1 What are Control Statements? Explain their types.
Ans: When a program executes line by line in the given sequence, it is called Sequential Execution of
the program. We can control this execution flow in the program as per our requirements. Those
statements that control the flow of execution of statements in the program are called Control
Statements. These statements can be classified into following three categories:
 Branching Statements (if else and switch case)
 Looping Statements (for, while and do while)
 Jumping Statements (goto, break and continue)

Q:2 What is for loop? What are the two different categories of loops?
Ans: Looping statements are also called Iterative Statements. Sometimes we face situations that
require repeated exection of statements in the program. In such situtaions, loops help us to repeat
statements in the program. Loops can be categorized into
following two types:
 Pre-Test Loops: Pre-Test loops are also called Entry-
Controlled loops. In these loops, test condition is
tested before the body of the loop. ‘for’ and ‘while’
loops are the examples of pre-test loops.
 Post-Test Loops: Post-Test loops are also called Exit-
Controlled loops. In these loops, test condition is
tested after the body of the loop. ‘do while’ loop is an
example of post-test loop.

2|Page
12th Class Computer Science (Session 2023-24)

Q:3 What is jumping statement? Explain its types?


Ans: Jumping statements in the C progamming are used to change the normal execution flow of the
program. We can transfer the exection flow from one location to some other location in the program.
Following jumping statements are used in the C programming:
 goto statement: For using these statements, we have to use labels in the program. This
statement transfers the execution control at the label specified after the goto statement.
 break statement: This statement is used to terminate the exection of a loop or switch statement
and transfter the execution control immediately after the loop or switch statement.
 continue statement: Sometimes it is benficial to skip statements in the loop. continue statement
is used in such situtations.

Q:4 What is do while loop? How it differs from while loop?


Ans: ‘do while’ loop is a post test loop. The ‘do while’ loop is the only loop which is known as the post-
test loop in C programming. In ‘do while’ loop, test-condition is tested after the exection of body of the
loop. In this loop, minimum number of executions for the body of the loop will be one. It is so because
whenever this loop is executed for the first time, its body gets executed without executing the test-
condition of the loop.
‘do while’ loop is different from the ‘while’ loop. ‘while’ loop is a pre-test loop in which test condition
is tested before the execution of body of loop. The minimum number of executions for the body of the
loop will be zero. It is so because whenever this loop is executed, its body can not be executed without
executing the test-condition even once.

3|Page

You might also like