Professional Documents
Culture Documents
Class 8th Chapter 6 Excersie
Class 8th Chapter 6 Excersie
i. Use the “for” ii. Using the iii. Using the “do- iv. All of
keyword “While” while” keyword above
keyword
b. How do you create an if statement in C?
i. Using the “if” ii. Using the iii. Using the “else” iv. All of
keyword “then” keyword keyword above
c. How do you print output to screen in C?
i. Using the “print” ii. Using the iii. Using the “printf” iv. Using the
function “echo” function function “cout”
function
d. Do-while loop
i. Always executes ii. Cannot contain iii. The code inside its iv. None of
the code block at nested loop loop keeps above
least once repeating even
when false
e. Which of the below are not the types of operators being used in C language?
The purpose of this operator is to assign value to a variable. The most used assignment operator is “=”
5. Relational Operators in C
Mainly used for checking relationships between operands. (>,<,>=,<=,!=)
6. Logical Operators in C
In the C programming language, Logical operators are mostly used for decision making. A logical operator
returns either 0 or 1 whether the condition is true or false.
5) What are the advantages of function?
Some of the key benefits of using functions are:
• Enables reusability and reduces redundancy.
• Makes a code modular.
• Provides abstraction functionality.
• The program becomes easy to understand and manage.
• Breaks an extensive program into smaller and simpler pieces.
6) Describe the function of control statements and its types.
Control statements are used to control the flow of programs and are essential for writing correct code. They
allow us to change what happens when an if statement is met with true or false. They also allow us to skip over
code if an else statement is met with true or false.
The decision control statements are further divided into three types that are: if statements, if-else statements,
and switch-case statements.
7) Why are files needed?
Files are used to store data in a storage device permanently. File handling provides a mechanism to store the
output of a program in a file and to perform various operations on it. A stream is an abstraction that represents
a device on which operations of input and output are performed.
Lab Based Question:
Design a program that utilizes all arithmetic operators. Program should include scanf() and printf().
3) C language code for addition of two number using user defined function.