Thursday, 14 July 2016


July, 2011

1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and
PART TWO contains FIVE questions.
2. PART ONE is to be answered in the TEAR-OFF ANSWER SHEET only, attached to the
question paper, as per the instructions contained therein. PART ONE is NOT to be answered in
the answer book.
3. Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO will be
supplied at the table when the answer sheet for PART ONE is returned. However, candidates,
who complete PART ONE earlier than one hour, can collect the answer book for PART TWO
immediately after handing over the answer sheet for PART ONE.

(PART ONE – 40; PART TWO – 60)

(Answer all the questions)

1. Each question below gives a multiple choice of answers. Choose the most appropriate
one and enter in the “tear-off” answer sheet attached to the question paper, following
instructions therein. (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;
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
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.
2.2 Sizes of short integer and long integer would vary from one platform to another.
2.3 Switch statements can also be used to switch on strings.
2.4 The expression on the right hand side of && and || operators does not get evaluated if the left
hand side determines the outcome.
2.5 Two different operators would always have different associativity.
2.6 Functions can return a floating point number.
2.7 A preprocessor directive is a message from compiler to the linker.
2.8 NULL pointer is not same as an uninitialized pointer.
2.9 Structures cannot contain a pointer to itself.
2.10 In a function two return statements should never occur.

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)

                                       X                                                    Y

3.1 Round off a value 1.66 to 2.0                       A. Must be declared as void
3.2 Logical Operator                                          B. &
3.3 ++*ptr                                                          C. Ptr is a pointer to an array of 10
3.4 Modular Design                                           D. Scope till the end of the function
3.5 srtlen(“123456”)                                          E. &&
3.6 fseek                                                             F. Random access in the file; file
specified through file descriptor                        G. Useful for link list Implementation
3.7 A function that returns objects
 of different types
3.8 int (*ptr)[10]                                               H. ceil(x)
3.9 Automatic variable                                     I. Each function should perform one
3.10 self referential structure                           J. Random access in the file; file
specified through file pointer
                                                                         K. 6
                                                                         L. (*ptr)++
                                                                       M. Easy to Debug

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 ________.
4.2 ________ is used to transfer control from a function back to the calling function.
4.3 The ________ operator is used to get value at address stored in a pointer variable.
4.4 ________ is more appropriate for reading in a multi-word string.
4.5 A Register variable is expected to be placed in machine ________.
4.6 The operator i << 2 is equivalent to ________ i by 4.
4.7 The ________ 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 ________ order.
4.9 When a variable is passed to a function, by ________, its value remains unchanged in the
calling program.
4.10 To share a variable across different files, ________ storage class is used.

(Answer any FOUR questions)

a) Write a Program to count lines, words and characters with a definition that a word is any
sequence of characters that does not contain a blank, tab or new line.
b) Write a function to swap two integers. The function does not return any value.

a) What is the significance of header file in a C Program? What do the header files usually
b) What is union data type? Define a union ‘u’ to hold a integer, float and character variable.
c) Evaluate the following expressions, indicating which ones are true or false.
1. 10 = = 9 + 1
2. 10 && 8
3. 8 || 0
4. 0 && 0
5. Let X = 10 and Y=9;
X >= 8 && Y <= X

a) Write a program using function to read an array from the user and print the odd number at odd
position and prints the even numbers at even positions. For example input array is 1 2 3 4 and
output is 2 1 4 3.
b) How Compilation, Linking and Loading are related? Also explain the basic task of a Compiler,
Linker and Loader.
c) List out the rules to declare a valid variable in ‘C’ program. Evaluate the following expression
and show the hierarchy of operations:
(2 + 4)/3 + 2 % 3 * 2 - 5

a) What is dynamic memory allocation? Mention four functions used for dynamic memory
b) What are command line arguments? Explain with the help of a suitable example.
c) Define a two dimensional array ‘int a[10][10]’. Write a ‘C’ program to initialize this array with
numbers between 0 and 99. Then print the contents of ‘a’.

a) Define a structure that describes a hotel. It should have members that include the name,
address, grade, average room charge and number of rooms.
Write a function to perform the following tasks.
i) To print all hotels details of a given grade in order of charges.
ii) To print hotel details with room charges less than given values.
b) What are the disadvantages of nested if-else statement?

Next Set