THROUGH ‘C’ LANGUAGE JUL 2015
1.1 Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1
A) * / % + - =
B) = * / % + -
C) / * % - + =
D) * % / - + =
1.2 Which of the following is the correct order if calling functions in the below code?
a = f1(23, 14) * f2(12/4) + f3();
A) f1, f2, f3
B) f3, f2, f1
C) Order may vary from compiler to compiler
D) None of the above
1.3 How many times "IndiaBIX" is get printed?
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IndiaBIX");
}
return 0;
}
A) Infinite times
B) 11 times
C) 0 time
D) 10 times
1.4 What do the following declaration signify? void *cmp();
A) cmp is a pointer to an void type.
B) cmp is a void type pointer variable.
C) cmp is a function that return a void pointer.
D) cmp function returns nothing.
1.5 When following piece of code is executed, what output will be generated?
#include<stdio.h>
int main(){
char arr[7]="Network";
printf("%s", arr);
return 0; }
A) Network
B) N
C) Garbage value
D) Compilation error
1.6 The result of a Relational operation is always
A) either True or False
B) is less than or is more than
C) is equal or less or more
D) All of the above
1.7 The keyword used to transfer control from a function back to the calling function is
A) switch
B) goto
C) go back
D) return
1.8 What is the similarity between a structure, union and enumeration?
A) All of them let you define new values
B) All of them let you define new data types
C) All of them let you define new pointers
D) All of them let you define new structures
1.9 Which of the following cannot be used as identifiers?
A) Spaces
B) Digits
C) Underscores
D) Letters
1.10 How many times is a do while loop guaranteed to loop?
A) 0
B) Infinitely
C) 1
D) Variable
Q.2. TRUE or FALSE.
2.1 Functions can be called either by value or reference.
TRUE
2.2 Comma operator is used for separation.
TRUE
2.3 The size of a structure can be determined by both size of variable name and size of (struct
tag).
TRUE
2.4 While loop is post tested loop.
FALSE
2.5 All of the following are valid expressions in C.
a = 2 + (b = 5);
a = b = c = 5;
a = 11 % 3;
TRUE
2.6 A variable is a string that varies during program execution.
FALSE
2.7 void (*ptr)() is a pointer to a function which receives nothing and returns nothing.
TRUE
2.8 Calling a uninitialized variable will provide zero value.
FALSE
2.9 C language cannot be used for database manipulation.
TRUE
2.10 In the expression a=b=5 the order of Assignment is NOT decided by Associativity of
operators.
FALSE
Q.3. Match words and phrases
SR NO. | X | Y(Ans.) |
1 | size of long int in byte | two |
2 | pp[i] can be written as | *(d + i) |
3 | Union | is a memory location that is used by several different variables, which may be of different type |
4 | malloc() | allocates memory but does not clear memory |
5 | typedef | can be used to create variables of old types |
6 | int(*pp)[10] | pp is pointer to an array of integer |
7 | Structure | is different memory location that is used by several different variables, which may be of different type |
8 | calloc( ) | allocate and clear memory |
9 | int(*pp)(void*,void*) | pp is function that returns pointer to integer |
10 | while(1) | Unending loop if no break statement inside the body |
Q.4. Fill in the blank
4.1 An array element is accessed using an __index______ number.
4.2 NULL is macro constant which has been defined in the header file ___stdio.h_____.
4.3 Function ___fseekf_____ repositions the file position pointer to the beginning of the file.
4.4 A library function ___exit_____ causes an exit from the program in which it occurs.
4.5 The __break______ statement causes an exit from the innermost loop or switch.
4.6 __static______ data member can only be used in static functions.
4.7 __pointer______ cannot be legitimately passed to a function.
4.8 The smallest data item a computer can process is called a(n) ___Bit_____.
4.9 A function call mechanism that passes arguments to a function by passing a copy of the
values of the arguments is ___call by value_____.
4.10 Name the header file to be included for the use of built in function isalnum() is _Ctype.h_.
Options.
A. Bit
B. header file
C. fseekf
D. call by value
E. static
F. exit
G. index
H. stdio.h
I. break
J. Ctype.h
K. unstructured
L. getc
M. pointer
Long Questions
Q.5.
a) Write a C program to read a line and print it reverse using recursive function.
b) Write a C program to print given number of terms of a Fibonacci series.
c) Write a C program to find the square root of a given quadratic equation.
(5+5+5)
Q.6.
a) Write a C program to find size of structure without using sizeof operator.
b) What are merits and demerits of array in C?
c) What is dangling pointer in C? What is wild pointer in C? Give example.
(5+5+5)
Q.7.
a) What will be output of the operations below?
main()
{ int a=10,b=25;
a=b++ + a++;
b= ++b + ++a;
printf(“%d %d \n”,a,b); }
b) Define void data type and write any three use of it.
c) Do you think C language support ‘pointer to function’? Explain it by any example?
(4+5+6)
Q.8.
a) Write a C program that displays the recommended actions depending on the color of a
traffic light using the switch statement.
b) Write a C program to write a line of string in a text file.
(5+10)
Q.9.
a) In the following declaration statement:
char c=’A’;
Variable c stores one byte of memory space while character constants ‘A’ stores one byte
memory space. How one byte variables can stores two byte character constant? What is
automatic type promotion in c?
b) Write a C program to modify the constant variable.
c) Why we use do-while loop in C? Also give any properties which you know.
(5+5+5)
Post a Comment
Leave a Reply