(O-LEVEL
PAPER)
M3-R4:
PROGRAMMING & PROBLEM SOLVING (JULY 2019)
THROUGH
‘C’ LANGUAGE
PART
ONE
DURATION:
3 Hours M.M.100
ANSWER
ALL THE QUESTIONS:
1.
Each question below gives a
multiple choice of answers. Choose the most appropriate one and enter in the
“OMR” answer sheet supplied with the question paper, following instructions
therein. (1×10)
1.
1 Which of
the following is a keyword used for a storage class?
(A) printf
(B) external
(C)
auto
(D) scanf
Explanation: – Storage class defines the location
and visibility of any variable. There are four types
of storage class :auto,extern,static
and register.
1.2. Which pair of functions below are used for single character I/O?
(A)
getchar() and putchar()
(B) scanf() and printf()
(C) input() and output()
(D) None of these
Explanation:-
getchar() is used
read the single character input at run time whereas putchar() is
used to write the single character
output at runtime.
1.3. What is the output of below
program?
void main(){
char*p=”Hello world”;
int*q;
p++;
q = (int*)p;
q++;
printf(“n%sn%s”,p,q); }
(A) ello world
Ello world
(B)
Compiler error
(C) lo world
lo world
(D) ello world
world
Explanation:-
The above program shows an compiler error.
1.4. Which of the following is a Scalar
Data type?
(A)
Float
(B) Union
(C) Array
(D) Linked list
Explanation:-A scalar
data structure is a data type which holds only a single atomic value at a
time.
commonly used scalar data type are:
·
Numeric
·
Character
·
Integer
·
Logical
·
Complex
1.5. Header files in C contain:
(A) Compiler commands
(B) Library
functions
(C) Header information of C
programs
(D) Operator for files
Explanation:-
In C, header files contains the predefined library functions.
1.6. What is the binary number equivalent of
the decimal number 12?
(A) 1100
(B) 1010
(C) 1001
(D) 1110
Explanation:-
1100
: 23+22+0+0= 12.
1010:
23+0+21+0= 10.
1001 : 23+0+0+20=
9.
1110: 23+22+21+0=
14.
1.7. Pointers are of :
(A) integer data type
(B) character data type
(C) unsigned integer data types
(D) none of these
Explanation:-Pointer
can be of int, char, array, function, or
any other type.
1.8. In C, if you pass an array as an argument
to a function, what actually 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
Explanation:-
Whenever an array is passed to a function then the base address is passed to
the
function the other things
are calculated by it.
1.9. Which of the following fopen() statements
is illegal in C ?
(A) fp =
fopen(“abc.txt”, “r”);
(B) fp =
fopen(“c:/user1/abc.txt”, “w”);
(C) fp =
fopen(“abc”, “w”);
(D) none of
the mentioned
Explanation:-The
basic syntax for fopen():-
FILE *fopen(const char
*file_name, const char *mode_of_operation);
1.10. Which one of the following is not
akeyword in C language?
(A) main
(B) endl
(C) float
(D) switch
Explanation:
– There are 32 keywords in C language. These are as
follows:
auto |
double |
int |
struct |
break |
else |
long |
switch |
case |
enum |
register |
typedef |
char |
extern |
return |
union |
continue |
for |
signed |
void |
do |
if |
static |
while |
default |
goto |
sizeof |
volatile |
const |
float |
short |
unsigned |
2.
Each
statement below is either TRUE or FALSE. Choose the most appropriate one and
ENTER in the “OMR” answer sheet supplied with the question paper, following
instructions therein.
(1×10=10)
2.1 Array
int a[5] can be used to store five character a, b, c, d and e into it.
TRUE
Explanation:
– inta[5] declares that
an array has size of 5 and contains 5
elements in it.
2.2 C
language was initially designed and developed at Microsoft Corporation of USA.
FALSE
Explanation:
– C was developed by Denis
Ritchie at AT & T Bell laboratory, in 1972.
2.3 A
semicolon must be placed after closing the conditional expression in a do-while
construct.
TRUE
Explanation:
– A semicolon (;) is
used to terminate the statement. Also it must be
placed after closing the conditional expression in a do-while construct.
2.4 Ternary
expression is a selective control construct.
TRUE
Explanation:
– Yes, Ternary expression is a
selective control construct. It works like a
if – else statement.
The
syntax of conditional or ternary operator is as-
variable = Expression1 ? Expression2 : Expression3
2.5 All the
functions, except main() function do not execute on their own, they require a
calling function.
FALSE
Explanation:
– All functions are called
recursively except main().
2.6
Recursive call is not allowed for main() function.
FALSE
Explanation:
– main () function can be
recursively called in C language. We can call main() within the main ()
function.
2.7 A
structure cannot contain the structure itself as its member.
FALSE
2.8
Pointers to pointers is a term used to describe pointers whose contents are the
address of another pointer.
TRUE
2.9 In C,
there is a function name strcat() used to concatenate two strings.
TRUE
2.10 Values
of predefined macros can be printed using printf statement in C program.
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 “OMR” answer sheet
supplied with the question paper, following instructions therein. (1×10=10)
|
X |
|
Y |
3.1 |
Keyword |
A. |
fseek() |
3.2 |
Statement |
B. |
malloc() |
3.3 |
Library |
C. |
switch-case |
3.4 |
Relational |
D. |
loops control |
3.5 |
Function |
E. |
Argument |
3.6 |
If you |
F. |
fflush() |
3.7 |
A piece |
G. |
for( ; ; |
3.8 |
Function |
H. |
Return |
3.9 |
Function |
I. |
Continue |
3.10 |
Unending |
J. |
Break |
|
|
K. |
main() |
|
|
L. |
Structure |
|
|
M. |
calloc() |
Ans:
|
X |
|
Y |
3.1 |
Keyword used to |
A. |
Return |
3.2 |
Statement used to |
B. |
Continue |
3.3. |
Library function |
C. |
fflush() |
3.4 |
Relational |
D. |
structure |
3.5 |
Function that |
E. |
calloc() |
3.6 |
If you have to use |
F. |
switch-case control |
3.7 |
A piece of |
G. |
argument |
3.8 |
Function that |
H. |
malloc() |
3.9 |
Function used for |
I. |
fseek() |
3.10 |
Unending loop if no |
J. |
for( ; ; ) |
|
|
K. |
loop control |
|
|
L. |
break |
|
|
M. |
main() |
4. Each
statement below has a blank space to fit one of the words(s) and phrase(s) in
the list below.
Choose the most appropriate
options, enter your choice in the “OMR” answer sheet supplied with the question
paper, following instructions therein. (1X10=10)
A. |
Ternary |
B. |
sizeof |
C |
null |
D. |
void |
E. |
semicolon |
F. |
# |
G. |
increment |
H. |
extern |
I. |
static |
J. |
structure |
K. |
pointer |
L. |
reference |
M. |
getch() |
|
|
|
|
4.1 C language is
suited for structure
programming.
4.2 An extern storage class can be used to declare global
variable known to all the functions in the
life.
4.3 getch () function can be used to read a single
character.
4.4 The operator “++”
is known as increment operator.
4.5 The sizeof operator can be used to
allocate memory space dynamically to variables during
execution of a program.
4.6 A pointer to pointer variable
points to another pointer.
4.7 A function with
no return type is declared as void. .
4.8 A function
prototype is always terminated by semicolon sign.
4.9 When a structure
is passed to a function, then it should pass by reference .
4.10 The conditional
operator (? : ) is a ternary
operator.