Pages

Saturday, 18 April 2020

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

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

1. Each question below gives a multiple choice of answers. Choose  the  most  appropriate  one with the question paper, following instructions therein. 
(1x10)

1.1 : Which one is incorrect statement for C Language?
A) C compiler supports octal integer constant.
B) C compiler supports hexadecimal integer constant.
C) C compiler supports binary integer constant.
D) C compiler supports decimal integer constant
Answer

1.2 : What will be the output of the following code?
int main()
{
int x,y,z;
x='1'-'0'; /*line 1*/
y='a'b='b' /*Line 2*/
z=a+b;
printf("%d",z);
}

A) 0
B) Error because of incorrect line-1 only.
C) Error because of incorrect line-1 and line-2.
D) Error because of incorrect line-2 only.
1.3 : *ptr++ is equivalent to
A)  ptr++ B) *ptr
C)  ++ptr D) ++*ptr
1.4 : Which of the following is not a proper storage class 
A)  auto B) dcc
C)  static D) extern
1.5 : Which of the following cannot be used as identifiers?
A)  spaces B) digits
C)  underscores D) letters
1.6 : How many times is a do while loop guaranteed to loop?
A)  0 B)  Infinitely
C)  1 D)  Variable
1.7 : Precedence is used
A) To determine which operator evaluated first from left to right.
B) To determine the level of an operator in a program.
C) To determine how an expression involving more than one operator is evaluated.
D) To check the expression is valid or not.
1.8 : Identify the correct sequence of steps to run a program
A) Link, Load, Code, Compile & Execute
B) Code, Compile, Link, Execute & Load
C) Code, Compile, Link, Load & Execute
D) Compile, Code, Link, Load & Execute
1.9 : What will be the output of the following code?
main()
{
int x=0,y=0;
if(x>0)
if(y>0)
  printf("True");
else
printf("False");
}
A) Blank screen
B) True
C) False
D) Error because of dangling else problem
1.10 : What will be the output of the following code?
 main()
{
int i=2;,*j;
j=&i;
printf("%d",i**j*i+*j);
A) Syntax error due to Invalid expression in printf
B) Print junk value
C) 16
D) 10
 Answer

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and enter your choice in the supplied with the question paper, following instructions therein. (1x10)

2.1 Two pointer variables cannot be subtracted.
2.2 1.0 is an example of double constant and float constant.
2.3 #define is used to define symbolic constant.
2.4 const is a keyword that is used to define symbolic constant.
2.5 Two dimensional array is stored in memory physically as one-dimensional array.
2.6 size of a pointer, which points to a structure, depends on size of a structure.
2.7 All the members of a union share the same memory location.
2.8 break keyword is mandatory in switch case structure.
2.9 Using fprintf function, we can print on the standard output device.
2.10 It is better to use array than a linked list, when there is a fixed size list in a program.

Answer


3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in following instructions therein. (1x10)

X
Y
3.1
It is an operator that calculates size of a structure variable
A.
strrev
3.2
Function that reverse a string
B.
integer
3.3
Constant value 32767L is an example of
C.
Float
3.4
Address of arguments is passed in this method of passing
D.
goto
3.5
It is an unconditional jump statement
E.
Double quotation
3.6
Data type that can store only 0 and positive numbers
F.
Unsigned integers
3.7
All the string constant must be covered between this symbol
G.
typedef
3.8
It is a keyword used to assign alternative name to existing data type
H.
struct
3.9
Data type of 45.2f is
I.
long integer
3.10
Return type of printf function is
J.
sizeof


K.
switch


L.
pass by address


M.
void

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

A.
semicolon
B.
conditional operator
C.
asterisk
D.
dot
E.
math.h
F.
scanf( )
G.
Linked list
H.
integer
I.
zero
J.
void
K.
array
L.
ctype.h
M.
constant pointer





4.1                       _ symbol is used access the value pointed by a pointer.
4.2          When an array is declared, array name is defined as _             to first element.
4.3          M_PI is a constant that represents 22/7 ratio. It is declared in                header file.
4.4                       _ function reads data from stdin stream.
4.5          Default return type of any user-defined function is              
4.6 : in do..while loop ,______________ symbol is required after condition.
4.7          We must use                symbol to access structure members.
4.8                       _ data structure facilitates to insert and delete data during the program execution.
4.9          Global variable is initialized to _           _ by default.
4.10        A pair of question mark and colon is known as _            .


Answer


 PART TWO
(Answer any FOUR questions)

5.
a) Write a program that accept an array of 10 integers and a number to be deleted from the array if found. Represent deleted element with -1 and display final array. If not found print appropriate message.
b) Explain the role of linker and loader in compilation.
c) Explain the relation of array and pointer with example.
(7+4+4)

6.

7.

8.

9.

No comments:

Post a Comment