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

Chapter 7- Notes of C Operators & Conditional & Looping Statements

Chapter 7 covers C operators, conditional statements, and looping constructs. It explains the use of operators, if statements, loops, and comparison operators, providing definitions, examples, and syntax. The chapter also discusses the types of loops, including while and for loops, and arithmetic operators used for mathematical operations.

Uploaded by

optimus041210
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Chapter 7- Notes of C Operators & Conditional & Looping Statements

Chapter 7 covers C operators, conditional statements, and looping constructs. It explains the use of operators, if statements, loops, and comparison operators, providing definitions, examples, and syntax. The chapter also discusses the types of loops, including while and for loops, and arithmetic operators used for mathematical operations.

Uploaded by

optimus041210
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Chapter No: 7 C operators and Conditional and Looping Statements

Q.1 Fill in the blanks.


1) Operators are used to perform operations on variables and values.
2) if statement is used to specify a block of code to be executed if a condition is true.
3) Loops can execute a block of code as long as a specified condition is reached.
4) The while loop loops through a block of code as long as a specified condition is true.
5) Assignment operators are used to assign values to variables.

Q.2 Identify whether the statement is true or false. Rewrite the correct
statement if the statement is false.
1) Use the else if statement to specify a new condition if the first condition is true.
Ans: False - Use the else if statement to specify a new condition if the first condition is false.

2) Comparison operators are used to compare two values or variables.


Ans: True

3) When you know exactly how many times you want to loop through a block of code, use
the while loop.
Ans: False - When you know exactly how many times you want to loop through a block of code, use
the for loop.

4) Use the if statement to specify a block of code to be executed if a condition is true.


Ans: True

5) The return value of a comparison operator is either 1 or 0, which means true (1) or false (0).
Ans: True

Q.3 Multiple choice questions.


1) ______ statement is used to specify a block of code to be executed if the condition is false.
a) if statement b)else statement c) else-if statement d) if-else-if statement

2) Use the assignment operator ____ to assign the value.


a) < b) > c) ! d) =

3) _____ operators are used to perform common mathematical operations.


a) Arithmetic b) Logical c) Assignment d) Comparison

Q.4 Answer in one or two sentence.

1) What is assignment operator?


Ans: Assignment operators are used to assign values to variables. Use the (=) sign to assign the
value in it.
Example: x=10;
2) What is the use of if else statement?
Ans: else if statement is used to specify a new condition if the first condition is false.

3) What is the concept of loops?


Ans: Loops can execute a block of code as long as a specified condition is reached.
Loops are handy because they save time, reduce errors, and they make code more readable.

4) Define Conditional Statements (Decision making statements)?


Ans: They are also known as Decision-Making Statements and are used to evaluate one or
more conditions and make the decision whether to execute a set of statements or not.

5) What is comparison operator?


Ans: Comparison operators are used to compare two values or variables. It helps us to find
answers and make decisions.
Q.5 Answer the following questions in brief.
1) What is if statement? Write its syntax & example?
Ans: if statement is used to specify a block of code to be executed if a condition is true.

Syntax: if (condition) {
// block of code to be executed if the condition is true
}

Example:
#include <stdio.h>
int main() {
if (20 > 18) {
printf("20 is greater than 18");
}
return 0;
}

2) Explain Loops & Types of Looping Statement?


Ans: Loops can execute a block of code as long as a specified condition is reached.

Types of Looping Statement:


i)While Loop:
The while loop loops through a block of code as long as a specified condition is true:
ii) For Loop:
When you know exactly how many times you want to loop through a block of code, use
the for loop.
3) Explain Types of Operators in C?
Ans: i) Arithmetic Operators: Arithmetic operators are used to perform common mathematical
operations.
ii) Assignment Operators: These are used to assign values to variables. Use the (=) sign to assign
the value in it.
Example: x=10;

iii) Comparison operators: These are used to compare two values or variables. It helps us to find
answers and make decisions.

4) Explain For Loop with Syntax?

Ans: For loop: When you know exactly how many times you want to loop through a block of
code, use the for loop.

Syntax: for (expression 1; expression 2; expression 3) {


// code block to be executed
}

Expression 1 is executed (one time) before the execution of the code block.
Expression 2 defines the condition for executing the code block.
Expression 3 is executed (every time) after the code block has been executed.

5) Explain arithmetic operators in C?


Ans: Arithmetic operators are used to perform common mathematical operations.

Operator Name Description Example

+ Addition Adds together two values x+y

- Subtraction Subtracts one value from another x-y

* Multiplication Multiplies two values x*y

/ Division Divides one value by another x/y

You might also like