FREQUENTLY ASKED QUESTIONS ON C!
1.
What is a program?
A
program is a sequence of instructions written to perform a well defined task
with a computer.
2.
What are the
types of constants?
Based
on the type of data they represent, constants are of four types: Integer
constant, Floating-point constant, Character constant and String constant.
3.
Give the
different data type qualifiers.
Signed, unsigned, long and short are the
qualifiers that can alter the characteristics such as size or sign of a data
type.
4.
Define type
conversion.
Type
conversion is a process of converting operands in an expression from one data
type to another during execution. There
are two types of types conversion: automatic and explicit.
5.
What is the use
of break statement? (April
2013)
Break
statement is used to come out of a loop while the test condition is true. It can also be used to come out of the switch
statement after executing a case block.
6.
What is an
array? (October
2012)
An
array is a vector data type in which a group of related data items can be
stored under a single name.
7.
What are the
functions used to read strings?
(October 2012)
The
functions used for reading strings into memory are: scanf, getchar and gets.
8.
Define strcat() function.
Strcat()
function is used to join two strings together to form a new string (i.e.,
concatenated string). Its general form
is: strcat(string1, string2).
9.
Name any two
functions present in conio.h header
file. (April
2013)
The
functions getch() and clrscr() are the two functions
present in conio.h and are frequently used in a program.
10. Define isupper()
function.
This
function is used to check whether the given alphabet is in upper case or
not. It returns a non-zero integer if
its argument is in upper case or else it returns zero.
11. What is a return
statement? (October
2012)
Return statement
is an executable statement, which is used to return a value to the calling
program (caller) from the called one (callee).
It also returns the control back to the caller.
12.
Give the general
form of structure definition.
The general form
of the structure definition is as follows:
struct tag-field{
data type member-1;
data
type member-2;
-----------------------
-----------------------
data
type member-n;
}
where
struct – keyword to define structure
tag-field – name of the structure – a valid
identifier
datat ype – a valid data type such as int, float
etc.
13.
What is a
pointer?
A pointer is a
special variable that contains the address of another variable. Through pointer, we can access the content of
another variable indirectly.
14. How a pointer variable is declared? Give the syntax. (October
2012)
A pointer
variable can be declared using the following syntax:
data
type * variable;
where,
data
type – refers to the type of the
variable pointed to by the pointer
(e.g., int, float, etc.)
* –
is a pointer symbol
variable – is a valid C identifier
15. What are the types of memory allocation? (April
2013)
Memory
allocation are of two types: static memory allocation and dynamic memory allocation. Static memory allocation takes place during
compilation, whereas dynamic memory allocation happens during run time.
16. Define calloc()
function.
calloc()
is a function defined in stdio.h for the purpose of allocating the memory
dynamically. Using calloc(), we can
allocate multiple blocks of contiguous memory during runtime.
17. Define file.
A
file is a resource available in the secondary storage for storing the data
permanently. It can act as a placeholder
for storing and retrieving streams of data at any point of time.
18. Write the input functions used in file operation.
The
header file stdio.h has functions like getc(), getw() and fscanf()
for reading data from a file. getc() and
getw() read a single character or integer at a time, whereas fscanf() can fetch
different types of data from a file at a time.
19. Write any two error situations.
An
error may occur during any one of the following file operations:
a.
When
trying to read a file beyond the end-of-file marker.
b.
When
trying to use a file that has not yet been opened.
20.
What is
pre-processor? (April
2013)
Preprocessor
is a software module that reads the source code written in C language and
performs some operation on it before it is passed on to the compiler.