Please refer to Control Statements Class 12 Computer Science Important Questions with solutions provided below. These questions and answers have been provided for Class 12 Computer science based on the latest syllabus and examination guidelines issued by CBSE, NCERT, and KVS. Students should learn these problem solutions as it will help them to gain more marks in examinations. We have provided Important Questions for Class 12 Computer Science for all chapters in your book. These Board exam questions have been designed by expert teachers of Standard 12.
Class 12 Computer Science Important Questions Control Statements
Very Short Answer Type Questions:
Questions: Which statement is sometimes desirable to skip some statements inside the loop?
Ans: Jumping Statement – Continue
Questions: Which statements provide a way to repeat commands?
Ans: Looping Statements
Questions: Writing if statement with-in another if is called as?
Ans: Nested if statement
Questions: Which statements in C programming are used for altering the normal flow of a program?
Ans: Control Statements
Short Answer Type Questions:
Questions: 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 if given following:
(Please Visit http://cspunjab.nirmancampus.co.in for more computer science contents)
Questions: 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:
Questions: 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)
Questions: 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
Questions: 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. Following is the syntax of the while statement:
Long Answer Type Questions:
Questions: 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 posttest 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 testcondition 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.
Questions: 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)
Questions: 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.
Questions: What is switch statement? Write a program of switch statement?
Ans: switch statement is a multiway conditional control statement. This statement is similar to the if else if statement. It is a matter of preference which we use from these statements. switch statement can be slightly more efficient and easier to read. In switch-case, statements get executed when corresponding case constants are true only. Statements of defaults block gets executed only when all other cases are false. Following program shows the usage of switch statement in the program:
Questions: 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 pretest 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.