Exam NameC Language QUESTIONS
DescriptionC Language QUESTIONS and Answers exams contains the questions from various interview of IT industry.These questions are helpful to crack the IT interview.

Back to Parent Category
Create QuestionPDF   Start Exam
Question: The 'C' language is

Answer:None of the above

Question: Consider the program below in a hypothetical programming language which allows global variables and achoice of static or dynamic scoping int i;

program Main( )
i = 10;
call f ( );
procedure f( )
int i = 20; call g ( );
procedure g( )
print i; }

Let x be the value printed under static scoping and y be the value printed under dynamic scoping. Then x and y are

Answer:x = 10, y = 10

Question: printf("%c", 100);

Answer:Prints ASCII equivalent of 100

Question: The _______ memory allocation function modifies the previous allocated space.

Answer:realloc( )

Question: What does the following declaration mean?
int (*ptr) [10];

Answer:ptr is a pointer to an array of 10 integers.

Question: Which of the following has compilation error in C?

Answer:none of the above

Question: The correct way to round off a floating number x to an integer value is

Answer:y = (int) (x + 0.5)

Question: When the following code is executed what will be the value of x and y?
int x = 1, y = 0;
y = x++;

Answer:2, 1

Question: What is the result of the expression (1&2)+(3/4)?


Question: How many times the word 'print' shall be printed by the following program segment?

For (i=1, i<2,i++)
For (j=1,j<2,j++)
For (k=1,k<2,k++)


Question: Arrays in C language can have _________ with reference to memory representation.

Answer:Only one subscript

Question: Refer the points as listed below:
(a) What are the operator precedence rules?
(b) What are the operator associativity rules?
(c) What is the order of operand evaluation?
(d) Are there restrictions on operand evaluation side effects?
Which of the above must be considered as primary design issues for arithmetic expressions?

Answer:(a), (b), (c) and (d)

Question: What will be the output of the following segment of the program ?

main( )
char *s = "hello world";
int i = 7;
printf("%, *s", i, s);

Question: Trace the error :

void main( )
int *b, &a;
*b = 20
printf("%d, %d", a, *b)

Answer:Syntax error

Question: Match the following:
a. calloc( ) i. Frees previously allocated space
b. free( ) ii. Modifies previously allocated space
c. malloc( ) iii. Allocates space for array
d. realloc( ) iv. Allocates requested size of space
a b c d

Answer:iii i iv ii

Question: What is the size of the following Union? Assume that the size of int = 2, size of float = 4, size of char = 1

union tag {
int a;
float b;
char c;


Question: What is the output of the following program segment?

sum (n)
if ( n < 1 ) return n;
else return (n + sum(n-1));
print f("%d", sum(5));


Question: Assume that x and y is non-zero positive integers. What does the following program segment perform?

While (x! =0)
if (x>y)
x = x-y

Answer:Computes GCD of two numbers

Question: Consider the following program segment:

For (i=1; i<31, ++i)
for (j=1; j<31, ++j)
for (k=1; k<31, ++k)
if ((i+j+k) %3) = = 0);
d = d + 1;
printf("%d", d);

The output will be

Question: Consider the following two function declarations:
(i) int *f( )
(ii) int (*f)( )
Which of the following is true?

Answer:The first declaration is a function returning a pointer to an integer and the second is a pointer to function returning integer.