C Language 2018
C Language 2018
1.1 What will be output if you compile and execute the following „C‟ code
void main()
{
float a=5.2;
if(a==5.2)
printf(“equal”);
else if(a<5.2)
printf(“less than”);
else
printf(“greater than”);
}
A) Equal B) Less than
C) Greater than D) Compilation Error
1.2 What will be output if you compile and execute the following „C‟ code?
void main()
{
int i=4,x;
x=++i+++i+++i;
printf(“%d”,x);
}
A) 21 B) 18
C) 12 D) Compilation error
1.3 The following code for(;;) represents as infinite loop. It can be terminated by
A) Break B) Exit(0);
C) Abort(); D) All of the mentioned.
1.4 Arguments that take input by user before running a program are called
A) Main function arguments B) Main arguments
C) Command-line arguments D) Parameterized arguments
1.5 Automatic variables are allocated memory in:
www.samparkcomputers.com 2018 JAN
A) Heap B) Data Segment
C) Code Segment D) Stack
1.6 End of file is detected by
A) fend() B) endf()
C) EOF D) FEND
1.7 If the first string and the second string both are identical, then strcmp function returns:
A) A value of 0 B) Either 1 or 0
C) A value of 1 D) Any positive integer
1.8 Register variable are active
A) Outside the function B) Throughout the program
C) Only in the function where it is defined D) Surrounding of that function
1.9 What will be the output of following program?
#include
main()
{
int x,y=10;
x=y*null;
printf(“\n %d \n”,x);
}
A) Error B) 0
C) 10 D) Garbage Value
1.10 What is the output of this code
#include<stdio.h>
void main()
{
static int x;
if(x++<2)
main();
}
A) Infinite calls to main B) Run time error
C) Varies D) Main is called twice
Answers
www.samparkcomputers.com 2018 JAN
1.1 – (A ) 1.2 – (A ) 1.3 – ( D ) 1.4 –( C) 1.5 – (D )
1.6 – ( C ) 1.7 – ( A ) 1.8 – (C ) 1.9 – (D ) 1.10- (D )
2. Each statement below is either TRUE or FALSE. Choose the most appropriate one
and enter your choice in the “OMR” answer sheet supplied with the question paper,
following instructions therein.
Answers
2.1 – TRUE 2.2 – FALSE 2.3 – FALSE 2.4 – FALSE 2.5 – TRUE
2.6 – TRUE 2.7 – TRUE 2.8 – FALSE 2.9 – FALSE 2.10- FALSE
3. Math words and phrases in column X with the closest related meaning/words/
phrases(s) in column „Y‟. Enter your selection in the “OMR” answer sheet supplied
with the question paper, following instructions herein
X Y
3.1 In C size of data type varies from A. Char
compiler to compiler. In turboc 3.0 (16
bit compilers) size of double is _______
www.samparkcomputers.com 2018 JAN
byte
3.2 __________ is ternary operator B. 5
3.3 _____ is integral data type C. Break;
3.4 What will be the outpur when you D. True
execute following „C‟ code
#include<stdio.h>
void main()
{ char arr[7]=”network”;
printf(“%s”,arr);
}
#include<stdio.h>
int main()
{
struct s1;
int a;
}
struct s b={10};
printf(“%d”,b.s);
return 0;
}
3.7 ______ can be used out of Recursion G. Garbage Value
3.8 All the static variables are automatically H. ?:
initialized to zero
3.9 Character constants are coded using I. 8
double quotes
3.10 _______ is used to skip some J. Return
statement in a loop for that iteration
K. False
L. NULL
M. **
**
Answers
4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in
the list below. Choose the most appropriate option, enter your choice in the “OMR”
answer sheet supplied with the question paper, following instructions therein.
A. realloc() B. || C. gets()
D. // E. extern F. wild
G. macro H. malloc() I strrchr()
J /* K \ L dangling
M type conversion
4.1 A single line comment in C language source code can begin with ________
4.2 _________ is a logical OR operator
4.3 ________ int fun(); - the declaration indicates the presence of a global function
defined outside the current module or in another file.
4.4 ________ function that is most appropriate for reading in a multi-word string.
4.5 ________ operator is used to continue the definition of macro in the next line.
4.6. ________ is a inbuilt library function to adjust the allocated dynamic memory size
4.7 The library function ________ find the first occurrence of a substring in the string
4.8 #define allow us to define ___________
4.9 ________ is a way to promote from lower to higher data type
4.10 A pointer in C which has not been initialized is known as _________ pointer.
Answers
5.
c) Write a C program in which a scanf() function can read a complete paragraph of text
6.
7.
b) Define array and link list. Give one example for each showing its usage.
8.
c) How can you create your own header file in C programming ?. Briefly Explain