M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE
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.
TOTAL TIME: 3 HOURS TOTAL MARKS: 100
(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 If a=8, b=3 and c=-5 are integers, then value of a*b/c is
1.2 Which of the following is a valid identifier?
1.3 Which of the following is a valid string constant?
D) $ programming $
1.4 How will you free the allocated memory?
1.5 If i = 8 and j = 5 are two integers, then the value of (i>0) || (j < 5) is
1.6 How many times "INDIA" will get printed?
for(x=-1; x<=10; x++)
if(x < 5)
A) Infinite times
B) 11 times
C) 0 times
D) 10 times
1.7 A group of related data that share a common name is
D) None of the above
1.8 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.9 What does fp point to in the program?
A) The first character in the file
B) A structure which contains a char pointer which points to the first character of a file
C) The name of the file
D) The last character in the file
1.10 Which of the following language is predecessor to ‘C’ Programming Language?
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 Sizes of short integer and long integer would vary from one platform to another.
2.2 A structure can contain similar or dissimilar elements.
2.3 Names of functions in two different files linked together must be unique.
2.4 Functions that do not contain return statement do not return any value.
2.5 malloc() allocates memory from the heap and not from the stack.
2.6 Every ‘if’ statement must also include ‘else’.
2.7 The three declarations char **apple, char *apple, and char apple are same.
2.8 malloc() returns a float pointer if memory is allocated for storing float's and a double pointer if
memory is allocated for storing double's.
2.9 If we have to execute the program with different set of inputs, we need to recompile the program
2.10 Compiler translates the of source code into object code before the program can be executed.
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 Y3.1 Used when we want to test more A. menu selection
than one condition and make
3.2 Size of float and double in bytes B. logical operators
3.3 A linked list is a C. stdio.h
3.4 The switch statement is often used for D. stdlib.h
3.5 Input/output function prototypes and E. 4,8
macros are defined in
3.6 Gives the current position in the file F. integer value
3.7 Header file should be included to use G. strcat()
3.8 A piece of information passed to H. dynamic data structure
3.9 By default functions return I. strcmp()
3.10 To concatenate two strings we use J. argument
M. linked list
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)
D. goto E. void F. double quotes
G. Flowchart H. deallocate I. return
J. logical K. 1972 L. ->
4.1 ________ breaks the normal sequential execution of the program.
4.2 Character constants should be enclosed between ________.
4.3 The operator && is an example for ________ operator.
4.4 Pictorial representation of an algorithm is ________.
4.5 A pointer contains ________ until it is initialized.
4.6 If a function return type is declared as ________ it cannot return any value.
4.7 The ________ operator can be used to access structures elements using a pointer to structure
4.8 The keyword used to transfer control from a function back to the calling function is ________.
4.9 NULL macro is defined in ________ file.
4.10 ________ function is used to request memory space.
(Answer any FOUR questions)
a) What is the difference between linear search and binary search?
b) Write a ‘C’ program to find out sum of diagonal elements of a matrix using ‘C’.
c) Distinguish between compiler error and runtime error with the help of an example.
a) Write a ‘C’ program to copy data of one file to another file.
b) What is the scope of global, local and register variables.
c) What is a preprocessor and what are the advantages of preprocessor? What are the facilities
provided by preprocessor?
a) What is the difference between array and linked list? Discuss the advantage of linked list over
b) Write a program to create a link list. There should be 10 nodes in the list, each node contains
an integer between 1 – 10. The list should be printed at the end.
a) Differentiate between do-while loop and while loop with the help of one example for each.
b) What is the purpose of using functions in ‘C’ programming? Differentiate declaration and
definition of a function.
c) How will you pass parameters to a function? Briefly describe two mechanisms of parameter
passing in ‘C’ language.
a) Write a ‘C’ Program to create a file of numbers and copy odd number into second file and even number into third file.
b) Write a ‘C’ program to find out a factorial of a given number?