Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Chapter # 6: Advance C Language Fazaia Inter College & School Kohat

Objective Type Questions


a. How do you create a loop in C?

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?

i. Shift Operator ii. Assignment iii. Bitwise Operator iv. Union


Operator Operator

Descriptive Type Questions


1) What is the result of string constant “5+7” in C?
In C, the string constant "5+7" is just a sequence of characters enclosed in double quotes. It is not treated as
a mathematical expression, and you cannot perform arithmetic operations on it directly. Out will be : 5+7.
2) What is the result of string constant “8-3” in C?
In C, the string constant "8-3" is just a sequence of characters enclosed in double quotes. It is not treated as a
mathematical expression, and you cannot perform arithmetic operations on it directly. Out will be : 8-3.
3) What is the result of string constant “6*4” in C?
In C, the string constant "6*4" is just a sequence of characters enclosed in double quotes. It is not treated as
a mathematical expression, and you cannot perform arithmetic operations on it directly. Out will be : 6*4.
4) Describe different types of operators.
In C, there are various types of operators available to perform various operations.
1. Arithmetic Operators in C
The purpose of this operator is to perform mathematical operations like addition, subtraction, division,
multiplication etc
2. Increment Operator in C
Mainly used for incrementing the value of an integer. It is represented by the ‘++’ operator. ++x
3. Decrement Operator in C
Mainly used for decrementing the value of an integer. It is represented by the ‘--’ operator.
4. Assignment Operators in C

Teacher: Sir Ahmad Zarif 1|Page


Contact # 0343-924-9404
Chapter # 6: Advance C Language Fazaia Inter College & School Kohat

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().

Teacher: Sir Ahmad Zarif 2|Page


Contact # 0343-924-9404
Chapter # 6: Advance C Language Fazaia Inter College & School Kohat

SLO Based Question’s


Objective:
1) C language was created in . (1978)
2) && means. (Logical AND)
3) || means. (Logical OR)
4) ! means. (Logical Not)
5) in the escape sequence, a character is preceded by a. (backslash \)
6) %d, %f, %c, %s is. (format specifier)
7) %lf is use for. (Double float)
8) %x is use for. (Hexadecimal variable)
9) int add(int a, int b); is. (function prototype)
10) add(2,3) is . (function call)
11) ___________ pass to the function. (arguments)
Questions & Answer:
1) Write a C language code for find area of triangle.

2) Write a C language code for addition of two number by user input.

3) C language code for addition of two number using user defined function.

Function Name with Definition


Function Body

Teacher: Sir Ahmad Zarif 3|Page


Contact # 0343-924-9404
Chapter # 6: Advance C Language Fazaia Inter College & School Kohat

4) Write a C language code for if-statement.

5) Write a C language code for if-else statement.

6) Write a C language code for “for-Loop” to print descending order number


from 10 to 0.

7) Write a C language code for Do-While loop.

Teacher: Sir Ahmad Zarif 4|Page


Contact # 0343-924-9404
Chapter # 6: Advance C Language Fazaia Inter College & School Kohat

8) Write a C language code for nesting loop.

9) Write a C language code for Nested if-else statement.

Teacher: Sir Ahmad Zarif 5|Page


Contact # 0343-924-9404

You might also like