C Language QUESTIONS
Exam Name | C Language QUESTIONS |
---|---|
Description | C Language QUESTIONS and Answers exams contains the questions from various interview of IT industry.These questions are helpful to crack the IT interview. |
Exam Type | MASTER EXAM |
Authenticity | 9999 |
creator | Anirudh(39288) |
.
Question:
The 'C' language is
Answer:
Question:
Consider the program below in a hypothetical programming language which allows global variables and achoice of static or dynamic scoping int i;
Let x be the value printed under static scoping and y be the value printed under dynamic scoping. Then x and y are
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:
Question:
printf("%c", 100);
Answer:
Question:
The _______ memory allocation function modifies the previous allocated space.
Answer:
Question:
What does the following declaration mean?
int (*ptr) [10];
int (*ptr) [10];
Answer:
Question:
Which of the following has compilation error in C?
Answer:
Question:
The correct way to round off a floating number x to an integer value is
Answer:
Question:
When the following code is executed what will be the value of x and y?
int x = 1, y = 0;
y = x++;
int x = 1, y = 0;
y = x++;
Answer:
Question:
What is the result of the expression (1&2)+(3/4)?
Answer:
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++)
Printf("print/n")
Answer:
Question:
Arrays in C language can have _________ with reference to memory representation.
Answer:
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?
(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:
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:
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
Codes:
a b c d
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
Codes:
a b c d
Answer:
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;
};
Answer:
Question:
What is the output of the following program segment?
sum (n)
{
if ( n < 1 ) return n;
else return (n + sum(n-1));
}
main()
{
print f("%d", sum(5));
}
Answer:
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
else
y=y-x;
printf("%d",x);
Answer:
Question:
Consider the following program segment:
The output will be
d=0;
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?
(i) int *f( )
(ii) int (*f)( )
Which of the following is true?
Answer: