Thursday, March 1, 2018

M3-R4: JANUARY, 2012, DOEACC O LEVEL, C LANGUAGE PROGRAMMING ANSWER, CONDUCTED BY NIELIT.

"Olevel course of DOEACC Scheme is equivalent to a Foundation Level Course in Computer Applications. Students can acquire this qualification by undergoing this course and passing the examination conducted by the NIELIT.

1. Each question below gives a multiple choice of answers. (1x10)

1.1 What would be value of j after the following is executed?
k=17;
j=6;
if (k < 10)
j=8;
j=j+1;
j=j+2;
A) 8
B) 9
C) 7
D) 10

1.2 What will be output after compilation and execution of the following code?
#include<stdio.h>
int main(){ int array[3]={5}; int i;
for (i=0;i<=2;i++)
printf("%d ",array[i]); return 0;}
A) 5 garbage garbage
B) 5 0 0
C) 0 0 0
D) 5 5 5

1.3 In an assignment statement a=b; which of the following statement is true?
A) The variable a and the variable b are same.
B) The value of b is assigned to variable a but if b changes later, it will not effect the value of
variable a.
C) The value of b is assigned to variable a but if b changes later, it will effect the value of variable a.
D) The value of variable a is assigned to variable b, and the value of variable b is assigned to variable a.

1.4 Which code will print k 20 times?
A) for (i=1; i < 20; i++)
printf (“k”);
B) for (i=1; i = 20; i++)
printf (“k”);
C) for (i=0; i < 20; i++)
printf (“k”);
D) for (i=0; i <= 20; i++)
printf (“k”);

1.5 When the following piece of code is executed, what happens?
b = 3; a = b++;
A) a contains 3 and b contains 4
B) a contains 4 and b contains 4
C) a contains 4 and b contains 3
D) a contains 3 and b contains 3

1.6 What is the value of r after this code is executed?
r=2;
k=8;
if (r>3 || k>6 && r<5 ||k>10)
r=9;
else
r=6
A) 9
B) 2
C) 6
D) 8

1.7 Which of the following is not a valid relational operator?
A) <
B) =
C) >=
D) <=

1.8 What is the final value of x when the code int x; for(x=0; x<10; x++) {} is executed?
A) 10
B) 9
C) 0
D) 1

1.9 For the function
int operation (int A[], int n)
{
}
Which is the appropriate calling statement from main program?
A) s=operation(A[], 6)
B) operation(A, 6)
C) k=operation(A, 6)
D) d=operation(int A, 6)

1.10 Which is an incorrect variable name?
A) Id_No
B) ID_NO
C) IdNo
D) Id No

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one
and ENTER in the “tear-off” sheet attached to the question paper, following
instructions therein. (1x10)

2.1 The index of an array starts from 1. FALSE
2.2 Task of continue keyword is to transfer the control of program at the next step of the loop.TRUE
2.3 Every variable in c have three most fundamental attributes: Name, Value, Address. TRUE
2.4 It is guaranteed that the while loop will be executed at least once. FALSE
2.5 All of the following are valid expressions in C. FALSE
If a( = 6) b = 5;
a = b = c = 5;
a = 11 % 3
2.6 In ‘C’, parameters to a function can be passed by value but not by reference. FALSE
2.7 Changes made to an array inside a function are automatically reflected in calling program. TRUE
2.8 The operating system converts the ‘C’ program into machine language. FALSE
2.9 Every function in ‘C’ must have a “return” statement. FALSE
2.10 C is an object oriented programming language. FALSE

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 “tear-off” answer sheet
attached to the question paper, following instructions therein. (1x10)

A. p is pointer to an array of integer
B. joins two strings
C. returning a pointer to the beginning of the block
D. compares two strings
E. a dynamic data structure
F. two
G. can be used to create variables of old types
H. replaces one string by the other
I. is a memory location that is used by several different variables, which may be of different type
J. *(p + i)
K. is different memory location that is used by several
different variables, which may be of different type
L. a function calling itself
M. allocate and clear memory
                         
3.1 size of void pointer in byte  F
3.2 p[i] can be written as  J
3.3 Union  I
3.4 malloc()  C
3.5 recursion  L
3.6 int(*p)[10]  A
3.7 structure  K
3.8 linked list  E
3.9 strcmp()  D
3.10 strcat()  B

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 “tear-off” answer sheet attached to the question
paper, following instructions therein. (1x10)

A. bit B. text C. Void
D. byte E. string F. fputc
G. preprocessor H. logical operators I. fputs
J. char K. unstructured L. getc
M. 0's and 1's

4.1 Ultimately, all data items processed by a computer are reduced to combinations of
____M____.
4.2 ____H____ are used when we want to test more than one condition and make a decision.
4.3 If a function return type is declared as ____C____ it cannot return a value.
4.4 Function ____F____ writes a character to a specified file.
4.5 Function ____I____ writes a line to a specified file.
4.6 A group of related characters that conveys meaning is called a ____E____.
4.7 Most information stored in computer systems is stored in ____B____ files.
4.8 The smallest data item a computer can process is called a ____A____.
4.9 The ____G____ is a program that is executed before the source code is compiled.
4.10 If the pointer variable ptr holds the address of a char, the data type of *ptr will be ____J____.

1 comment: