Pages

Wednesday, 22 April 2020

Solved : PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE , July 18

Solved : NIELIT (O-Level) PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE , July 18

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 : Which programming method is followed in C language?
A)  Algorithm B) Flow-charts
C)  Procedural D) Object Oriented
Answer

1.2 : getchar() function is available in which header file?
A)  stdio.h B) conio.h
C)  math.h D)  header.h
1.3 : Find the output of following code
int main()
{
int i=-2;
printf(“-i = %d”,-i);
return 0;
}
A) -i=2 B) i=-2
C) -i=-2 D) -i=+2
1.4 : Which numbering system is not handled directly by the printf() conversion specifiers?
A) Decimal B) Binary
C) Octal D) Hexadecimal
1.5 : Which of the following is an incorrect assignment statement?
A)  N=m=0 B) Value+=10
C)  mySize=x<y?9:11 D) Value=+=10
1.6 : What will be the output of the following program?
int main()
{
int x=5;
printf(“%d %d %d”,x,x<<2,x>>2); 
}
A)   1 20 5 B)   5 1 20
C)   5 20 1 D)   20 1 5
1.7 : A programming construct in which a set of statement in a computer program can be executed repeatedly.
A) Loop statement B) Conditional statement
C) Block statement D) All of the above
1.8 : What will be the output of following program?
int main()
{
for(int c=1;c<=5;++c);
printf(“%d”,c);
}
A) 1 B) 5
C) 6 D) 12345
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) Base address of the array
D) Address of the last element of array
1.10 : How many times is a do while loop guaranteed to loop?
A) 0 B) Infinitely
C) 1 D) Variable
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. (1x10)

2.1 Function can be called either by value or reference.
2.2 A function cannot be defined inside another function.
2.3 Are the three declarations char **apple, char *apple[], and char apple[][] same?
2.4 A long double can be used if range of a double is not enough to accommodate a real number.
malloc() allocates memory from the heap and not from the stack.
2.6 While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.
2.7 A union cannot be nested in a structure.
2.8 The modulus operator cannot be used with a long double.
2.9 If the file to be included doesn't exist, the preprocessor flashes an error message.
2.10 A linked list is a linear data structure where each element is a separate object.

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 supplied with the question paper, following instructions therein. (1x10)

X
Y
3.1
Calls itself
A.
Infinite loop if no break statement inside the loop
3.2
String copy
B.
A user-defined data type in C which allows you to combine different data types to store a particular type of record.
3.3
Unary operator
C.
Modify the size of previously allocated space
3.4
while(2)
D.
Recursive functions
3.5
Structure
E.
strcpy()
3.6
realloc
F.
Explicit conversion
3.7
exit()
G.
--
3.8
Typecasting
H.
Collection of similar type of data elements
3.9
‘\v ‘ used for
I.
logical operators
3.10
Array is a
J.
strcat()


K.
Terminates program


L.
Vertical space


M.
+

Answer


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. (1x10)

A.
Const
B.
continue
C.
Two-dimensional
D.
Flowchart
E.
fputs
F.
2 bytes
G.
six
H.
break
I.
4 bytes
J.
sizeof
K.
Multi-dimensional
L.
*
M.
&





4.1                 Function                 writes a line to a specified file.
4.2                 Pictorial representation of an algorithm is               .
4.3                 A variable can be made constant by declaring it with the qualifier                at the time of initialization.
4.4                 The                 operator returns the number of byte the operand occupies.
4.5                 By default, the real numbers are printed with a precision of                decimal places.
4.6                 The                 statement when executed in a switch statement causes immediate exit from the structure.
4.7                 The                 statement is used to skip a part of the statement in a loop.
4.8                 An array that uses more than two subscript is referred to as                array.
4.9                 After incrementing a float pointer ptr by 1 it would be incremented by               .
4.10              The                 operator return the value of the variable to which its operand points.


PART TWO
( Answer any FOUR questions)

5.
Write a ‘C’ program to display following pattern:
A
(4+4+7)

6.
(5+5+5)

7.

No comments:

Post a Comment