Class Matric Part 2 NotesComputer class 10th

10th class computer science chapter 3 Conditional Logic

10th class computer science chapter 3 Conditional Logic on newsongoogle.com by Bilal Article

shorts and simple Question & Answers

Q.1: What do you know about Control Statements?
Ans:
In order to solve a problem, control statement is used to control the flow of execution of a program. Sometimes there is also need to execute one set of instructions if a particular condition is true and another set of instructions if the condition is false.


Q.2: What are the types of control statements?
Ans:
There are three types of control statements in C language. Sequential Control Statements Selection Control Statements Repetition Control Statements


Q.3: What is sequential control?
Ans:
Sequential control is the default control structure in C language. According to the sequential control, all the statements are executed in the given sequence.


Q.4: What Selection Statements?
Ans:
The statements which help us to decide which statements should be executed next, on the basis of conditions, are called selection statements.


Q.5: How many types of selection statement have?
Ans:
There are two types of selection statements.
If statement


Q.6: What is the use of if statement?
If-else statement
Ans:
C language provides if statement in which we specify a condition, and associate a code to it. The code gets executed if the specified condition turns out to be true, otherwise the code does not get executed.


Q.7: Write down the Structure of if statement.
Ans:
If statement has the following structure in C language:
if (condition)
{ Associated Code }


Q.8: What is the purpose of if in if statement structure?
Ans:
In if statement structure, if is a keyword that is followed by a condition inside parentheses ().A condition could be any valid expression including arithmetic expressions, relational expressions, logical expressions, or a combination of these.


Q.11: Why If-else Statement is used in C language?
Ans:
It executes the set of statements under if statement if the condition is true, otherwise executes the set of statements under else statement.


Q.12: Write down the general structure of if-else statement?
Ans:
General structure of the if-else statement is as follows:
if (condition)
{
Associated Code
}
else
{
Associated Code Asso
}
Associated code of If statement is executed if the condition is true, otherwise the code associated with else statement is executed.


Q.13: Define compound statement.
Ans:
A set of multiple instructions enclosed in braces is called a block (enclosed in curly braces) or a compound statement.


Q.14: How you can close if and if else statement?
Ans:
If there are more than one instruction under if statement or else statement, enclose them in the form of a block (enclosed in curly braces). Otherwise, the compiler considers only one instruction under it and further instructions are considered independent.
Easy Notes (Computer 10th)
CONDITIONAL LOGIC
(E-Series)


Q.15: What is Nested Selection Structures?
Ans:
Conditional statements within conditional statements are called nested selection structures.


Q.16: Write general structure for nested selection structure?
Ans:
Following general structure is true for nested selection structure.
if (condition 1 is true)
if (condition 2 is true)
Associated code
else
if (condition is true)
Associated code


Q.17: Write the if-else-if statement structure?
Ans:
C language also provides an if-else-if statement that has the following structure.
if (condition 1)
{
}
Code to be executed if condition 1 is true;
else if (condition 2)
{
Code to be executed if condition 1 is false but condition 2 is true; }
else if (condition N)
{
Code to be executed if all previous conditions are false but condition N is true; }
{
else
code to be be executed if all the conditions are false
}


Q.18: What common mistakes we do in compound statement?
Ans:
In compound statements, it is a common mistake to omit one or two braces while typing. To avoid this error, it is better to type the opening and closing braces first and then type the statements in the block (enclosed in curly braces).


Q.19: Write use of nested selection structure?
Ans:
Nested selection structure is used for decision making in C language.


Q.20: Define Condition?
Ans:
A condition could be any valid expression including arithmetic expressions, relational expressions, logical expressions, or a combination of these.

Multiple Choice Question

MCQS

1. We can control the flow of program execution through_
A. control statements✅

B. sequential control statements
C. selection control statements
D. repetition control statements


2. There are types of control statements in C language.
A. 2
B. 3✅
C. 5
D.7


3. Which one from the following is not a type of control statement?
A. sequential control statements
B. selection control statements
C. repetition statements control
D. check control statement✅


4. The statements which help us to decide which statements should be executed next, on the basis of conditions, are called
A. repetition control statements
B. sequential control statements
C. Selection Statements✅
D. check control statement


5. Types of selection statements are:
A. if statement
B. if-else statement
C. both A and B✅
D. nested statement


6. C language provides in which we specify a condition, and associate a code to it.
A. repetition control statements
B. if statement✅
C. if-else statement
D. selection control statements


7. The code gets executed if the specified condition turns out to be
A. False
B. True✅
C. both A and B
D. none


8. The structure of if statement is:
A. if (condition) Associated Code✅
B. (condition) Associated Code
C. else (condition) Associated Code
D. if else (condition)


9. In the structure of if statement, if is a keyword that is followed by a condition inside
A. ()✅

B. <>
C. {}
D. []


10. According to the all the statements are executed in the given sequence.
A. selection control
B. repetition control
C. sequential control✅
D. relational control


11. is the default control structure in C language.
A. Check control
B. Sequential control✅
C. Relational control
D. All


12. executes the set of statements under if statement if the condition is true.
A. Control statement
B. Condition statement
C. if statement
D. if-else statement✅


13. A set of multiple instructions enclosed in braces is called a or a
A. block, compound statement✅

B. block, relational statement
C. code, block
D. compound statement, code


14. If there are more than one instructions under if statement or else statement, enclose them in the form of a
A. Box
B. Braces
C. block✅
D. code


15. Conditional statements within conditional statements are called
A. Conditional structure
B. nested selection structures✅
C. if else structure
D. if nested selection


16. In, it is a common mistake to omit one or two braces while typing.
A. compound statements✅

B. control statement
C. selection statement
D. relational statement

Related Articles

Back to top button
Enable Notifications OK No thanks