Handwritten Text Recognition for manuscripts and early printed texts
Frequently asked questions in c
1. Frequently Asked Questions in C!
Developed by David Livingsto J, Coimbatore
Contact email: davidjlivingston@gmail.com
Blogs maintained by the author includees:
futureforyou.net
futureforyou.biz
2. 1. List out the various
arithmetic operators in C?
+ Addition
- Subtraction
* Multiplication
/ Divison
% Modulo Division
3. 2. What is an arithmetic
expression?
An arithmetic expression is a combination arithmetic
operators and operands of type integer.
4. 3) What are the various
relational operators in C?
< Less than
> Greater than
= Equal
!= Not equal
>= Greater than or equal to
<= Lesser than or equal to
5. 4) Write the various logical
operators in C?
&& - Logical AND
|| - Logical OR
! - Logical NOT
6. 5) Explain ternary operator
in C.
The ternary opearor is also known as Conditional
opearator. Syntax:
(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-
1
8. 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.
9. 7) List the various decision
making statements
available in C ?
1. If statement
2. If ..else statement.
3. Nested if statement
4. If ..else ladder statement
5. Switch statement
10. 8) Write the program logic
to find biggest among three
without using ” , =”
return (a>b) ? (a>c ? a:c) : (b>c ? b: c)
11. 9) What are the various
looping statements
available in C?
a) While statement
b) Do..while statement
c) For statement
12. 10) What is the difference
between while and do..while
statement?
* 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
attempt itself.
* The do..while is an exit controlled statement. The
statements in the block are executed at least once.
13. 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
memory locations.
* The array elements can be accessed using an integer
called index.
14. 12) What is the starting
index of an array in ‘C’?
The starting index of an array in ‘C’ is 0.
15. 13) What are the types of
array?
One dimensional array
Two dimensional array
Multidimensional array.
16. 14) What is a two
dimensional array?
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
index.
17. 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
program
* 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
18. 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.
19. 17) Write the syntax of the
function definition.
return-value-type function-name( parameter-list )
{
declarations and statements
}
20. 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
nothing
–Parameter-list: comma separated list, declares
parameters. A type must be listed explicitly for each
parameter unless, the parameter is of type int
21. 18) What is a recursive
function?
A function that calls itself is called a recursive
function.
22. 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
parameter
* Can be used when function does not need to modify
argument
* Helps us to avoid accidental changes in the actual
parameters
23. 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
24. 20) What is the use of
return statement?
The return statement is used to exit from the callee
(called function) and return a value to its caller.