Frequently Asked Questions in C!
Developed by David Livingsto J, Coimbatore
Contact email: email@example.com
Blogs maintained by the author includees:
1. List out the various
arithmetic operators in C?
% Modulo Division
2. What is an arithmetic
An arithmetic expression is a combination arithmetic
operators and operands of type integer.
3) What are the various
relational operators in C?
< Less than
> Greater than
!= Not equal
>= Greater than or equal to
<= Lesser than or equal to
4) Write the various logical
operators in C?
&& - Logical AND
|| - Logical OR
! - Logical NOT
5) Explain ternary operator
The ternary opearor is also known as Conditional
(expr 1) ? (expr-2) : expr-3)
The expr-1 is evaluated first. If it is true, the expr-2 is
evaluated and it is the value of expr-1 . If expr-1 is
false, expr-3 is evaluated and it is the value for expr-
Example for Ternary
Max =(A>B )? A : B
6) What is the use of
decision making statement?
Decision making statement is used to break the normal
flow of the program and execute another part of the
program based on some condition.
7) List the various decision
available in C ?
1. If statement
2. If ..else statement.
3. Nested if statement
4. If ..else ladder statement
5. Switch statement
8) Write the program logic
to find biggest among three
without using ” , =”
return (a>b) ? (a>c ? a:c) : (b>c ? b: c)
9) What are the various
available in C?
a) While statement
b) Do..while statement
c) For statement
10) What is the difference
between while and do..while
* While is an entry controlled statement. The
statements inside the while may not be executed at
all when the condition becomes false at the first
* The do..while is an exit controlled statement. The
statements in the block are executed at least once.
11) What is an array?
* An array is a collection of data of same data type.
* The elements of the array are stored in consecutive
* The array elements can be accessed using an integer
12) What is the starting
index of an array in ‘C’?
The starting index of an array in ‘C’ is 0.
13) What are the types of
One dimensional array
Two dimensional array
14) What is a two
Two dimensional array is an array of two dimension –
rows and columns. The elements in this array are
referenced with the help of its row and column
15) What are the
advantages of using
functions in a C program?
* Debugging is easier
* It is easier to understand the logic involved in the
* Testing is easier
* Recursive call is possible
* Irrelevant details from the user's point of view (i.e.,
the code) are hidden from the users of a function
* Functions are helpful in generalizing the program
16) What is a function?
A function is a sub procedure that contains a set
ofstatements for performing a task. Functions reduce
the amount of work involved in reusing some code.
They are normally called from the main part of the
program (main()) for their execution.
17) Write the syntax of the
return-value-type function-name( parameter-list )
declarations and statements
Elements of a Function:
–Function-name: any valid identifier
–Return-value-type: data type of the result (default
int). void – indicates that the function returns
–Parameter-list: comma separated list, declares
parameters. A type must be listed explicitly for each
parameter unless, the parameter is of type int
18) What is a recursive
A function that calls itself is called a recursive
19) What are the two
methods of function call?
Call by value
* Copy of argument is passed to function
* Changes in function do not reflect in actual
* Can be used when function does not need to modify
* Helps us to avoid accidental changes in the actual
Method of Function Call
Call by reference
* Passes the reference (address) of the actual
parameter to the formal parameter
* Changes in function reflect in actual parameter
* Can be used only with trusted functions
20) What is the use of
The return statement is used to exit from the callee
(called function) and return a value to its caller.