Solved : PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE , July 2021 | NIELIT O Level
Q. 1 : Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)
1.1 : The default storage class of a 'C' variable is :
(A) Auto
(B) Static
(C) Extern
(D) Register
1.2 : What is sizeof() in C ?
(A) Operator
(B) Function
(C) Macro
(D) None of these
1.3 : 1.3 int main()
{
extern int i; i = 20;
printf("%d", sizeof(i)); return 0;
}
(A) 20
(B) 0
(C) Undefined reference to i
(D) Linking Error
1.4 : 1.4 main()
{
int x = 10;
{
int x = 0; printf("%d",x);
}
}
(A) 10
(B) Compilation Error
(C) 0
(D) Undefined
1.5 : void main()
{
int a = 10/3; printf("%d",a);
}
(A) 3.33
(B) 3.0
(C) 3
(D) 0
What should be the output ?
void main()
{
int a = 10/3; printf("%d",a);
}
(A) 3.33
(B) 3.0
(C) 3
(D) 0
1.6 : What do you mean by "int (*ptr)[10]" ?
(A) ptr is an array of pointers to 10 integers
(B) ptr is a pointer to an array of 10 integers
(C) ptr is an array of 10 integers
(D) Invalid statement
1.7 : Which of the following is not logical operator ?
(A) &
(B) &&
(C) ||
(D) !
1.8 : Which of the following cannot be checked in a switch-case statement ?
(A) Character
(B) Integer
(C) Float
(D) enum
1.9 : In C, if you pass an array as an argument to a function, what actually gets passed ?
(A) Value of elements in array
(B) First element of the array
(C) Address of the last element of array
(D) Base address of the array
1.10 : 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) * % / - + =
2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “OMR” sheet attached to the question paper, following instructions therein. (1x10)
2.1 A function may have several declaration, but only one definition.
2.2 Only character or integer can be used in switch statement.
2.3 #define is known as preprocessor compiler directive.
2.4 sizeof( ) is a function that returns the size of a variable.
2.5 The return type of malloc function is void.
2.6 = is used for comparison, whereas, == is used for assignment of two quantities.
2.7 Blank spaces may be inserted between two words to improve the readability of the statement.
2.8 Continue keyword is used to skip one iteration of loop.
2.9 A file opened for writing already exists its contents would be overwritten.
2.10 In a call to printf() function the format specifier %b can be used to print binary equivalent of an integer.
Answer
3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the "OMR" answer sheet attached to the question paper, following instructions therein. (1x10)
X |
Y |
||
3.1 |
switch statement is often
used for |
A. |
Array |
3.2 |
The purpose of library
function fflush() is |
B. |
Entry control |
3.3 |
Do while Loop
is |
C. |
joins two strings |
3.4 |
fseek |
D. |
Converts a data type to another data type |
3.5 |
strcat() |
E. |
menu selection |
3.6 |
Typecasting |
F. |
To clear the specified buffer |
3.7 |
exit(0) in a 'C' program represents |
G. |
User defined data
type |
3.8 |
Union in C |
H. |
Exit control |
3.9 |
group of related
data of same type
that share a common name |
I. |
Termination of a program |
3.10 |
To insert
the comments in the program
this symbol is used |
J. |
to move file pointer
associated with a given file to a specific position |
|
|
K. |
Inbuilt data type |
|
|
L. |
<!--> |
|
|
M. |
/* |
4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “OMR” answer sheet attached to the question paper, following instructions therein. (1x10)
A. |
index |
B. |
NULL |
C. |
or |
D. |
recursion |
E. |
derived |
F. |
void |
G. |
global |
H. |
local |
I. |
flowchart |
J. |
break |
K. |
and |
L. |
left to right |
M. |
right to left |
|
|
|
|
4.1 The _______ statement causes an exit from the innermost loop or switch.
4.2 When a function calls itself again and again, it is called _______ .
4.3 The _______ value is used to access the data element of an array.
4.4 Each string is terminated with_______ character.
4.5 Array is _______ type of data type.
4.6 A variable declared inside a function is called _______ variable.
4.7 The_______ operator is true only when both the operands are true.
4.8 If a function return type is declared as _______ it cannot return any value.
4.9 _______ is a pictorial representation of an algorithm
4.10 _______ s++ has associativity .
Answer
PART TWO
(Answer any FOUR questions)
5. (a) Explain the command line argument in C programming with suitable example.
5. (b) Differentiate between break and continue.
5. (c) Write a 'C' program to check whether given number is prime or not .
(5x5x5)
6. (a) Write a suitable 'C' program to print the following pattern :
*
**
***
****
*****
6. (b) Explain about union datatype in C with suitable example.
6. (c) What is an array ? Explain declaration and initialization of two dimensional integer array in 'C' with suitable example.
(5x5x5)
7.(a) Write a program to store the information (name, roll and marks) of a student and display it on the screen using structures.
7. (b) Differentiate between do-while loop and while loop with the help of one example for each.
7. (c) Explain about pre and post increment operator and the ternary oeprator with example.
(5x5x5)
8. (a) What are preprocessor directions ? Why do we need them ? Explain various preprocessor directives.
8. (b) Write a recursive function to compute factorial of a number.
(8+7)
9. (a) Write 'C' program to copy content of one file into another file.
9. (b) Explain the following :
(i) static variable
(ii) auto variable
(iii) register variable
9. (c) Write a program to find greatest number in array using
(5+6+4)
No comments:
Post a Comment