Tuesday, February 27, 2018

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


"O" level 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 answer.  (1x10)

1.1 Which of the following cannot be checked in a switch case statement?
A) Character
B) Integer
C) Float
D) enum

1.2 Which header file should be included to use functions like malloc() and calloc()?
A) memory.h
B) stdlib.h
C) string.h
D) dos.h

1.3 For the program given below, which of the following statement is correct?
void main ( )
{
int i;
for(;scanf(“%d”.&i);printf(“%d”,i))
;
}
A) The for loop would not get executed at all.
B) The for loop would get executed only once.
C) The for loop would get executed 5 times.
D) The for loop would get executed infinite times.

1.4 In which order do the Relational, Arithmetic, Logical and Assignment operators get evaluated in
C?
A) Arithmetic, Relational, Logical, Assignment
B) Relational, Logical, Arithmetic, Assignment
C) Logical, Relational, Arithmetic, Assignment
D) Assignment, Arithmetic, Relational, Logical

1.5 By default a real number is treated as a
A) float
B) double
C) long double
D) integer

1.6 Which of the following function can be used to find the first occurrence of a given string in
another string?
A) strchr( )
B) strrchr( )
C) strstr( )
D) strnset( )

1.7 What will be the output of the following program?
void main( )
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e ={“Tiger”};
printf(“\n%d %f”,e.age,e.sal);
A) 0 0.000000
B) Garbage values
C) Error
D) None of the above

1.8 If a file is opened in ‘write’ mode, then
A) If it does not exist, an error is returned
B) If it does not exist, it is created
C) If it exists, then data is written at the end
D) If it exists, error is returned

1.9 If a variable is a pointer to a structure, then which of the following operator is used to access
data members of the structure through the pointer variable.
A) ‘.’
B) ‘&’
C) ‘*’
D) ‘->’

1.10 The && and | | operators
A) compare two numeric values
B) combine two numeric values
C) compare two boolean values
D) None of the above

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 Functions may have several declarations, but only one definition. FALSE
2.2 Sizes of short integer and long integer would vary from one platform to another. FALSE
2.3 Switch statements can also be used to switch on strings. TRUE
2.4 The expression on the right hand side of && and || operators does not get evaluated if the left hand side determines the outcome.TRUE
2.5 Two different operators would always have different associativity. FALSE
2.6 Functions can return a floating point number.TRUE
2.7 A preprocessor directive is a message from compiler to the linker.TRUE
2.8 NULL pointer is not same as an uninitialized pointer.TRUE
2.9 Structures cannot contain a pointer to itself. FALSE
2.10 In a function two return statements should never occur.TRUE

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. Must be declared as void
B. &
C. Ptr is a pointer to an array of 10
D. Scope till the end of the function
E. &&
F. Random access in the file; file
G. Useful for link list Implementation
H. ceil(x)
I. Each function should perform one
J. Random access in the file; file
K. 6
L. (*ptr)++
M. Easy to Debug

 
















3.1 Round off a value 1.66 to 2.0  H
3.2 Logical Operator  E
3.3 ++*ptr integers.  L
3.4 Modular Design  I
3.5 srtlen(“123456”) K
3.6 fseek specified through file descriptor  J
3.7 A function that returns objects of different types  A
3.8 int (*ptr)[10]  C
3.9 Automatic variable task D
3.10 self referential structure specified through file pointer G

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. Multiply B. Register C. Gets()
D. ‘.’ E. ‘&’ F. Reference
G. ‘*’ H. Overflow I. Arbitrary
J. Goto K. value L. extern
M. Return

4.1 Many recursive calls may result into stack ___H_____.
4.2 ____M____ is used to transfer control from a function back to the calling function.
4.3 The ____E____ operator is used to get value at address stored in a pointer variable.
4.4 ____C____ is more appropriate for reading in a multi-word string.
4.5 A Register variable is expected to be placed in machine ____B____.
4.6 The operator i << 2 is equivalent to ____A____ i by 4.
4.7 The ____D____ operator can be used access structure elements using a structure variable.
4.8 The function “lseek” provide a way to read or write a file in ____I____ order.
4.9 When a variable is passed to a function, by ____K____, its value remains unchanged in the
calling program.
4.10 To share a variable across different files, ____L____ storage class is used.

No comments:

Post a Comment