Thursday, 10 October 2019

Solved : M3-R4: PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE , July-2016

Solved : M3-R4: PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE , July-2016

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.1 How many times below for loop will be executed?
#include<stdio.h> 
int main()
{
int i=0; for(;;)
printf("%d",i); return 0;
}

A) 0 times
B) Infinite times
C) 10 times
D) 1 times
Answer


1.2 : Find output of the following program?
#include<stdio.h> int main()
{
char str[] = "Smaller"; int a = 100;
printf(a > 10 ? "Greater" : "%s", str); return 0;
}
A) Greater
B) Smaller
C) Compile Error
D)    100
Answer

1.3 : checked in a switch-case statement?
A) Character
B) Integer
C) Float
D) enum

1.4 : Difference between calloc() and malloc() is:
A) calloc() takes a single argument while malloc() needs two arguments
B) malloc() takes a single argument while calloc() needs two arguments
C) malloc() initializes the allocated memory to ZERO
D) calloc() initializes the allocated memory to NULL
1.5 : What is the purpose of getc()?
A) read a character from STDIN
B) read a character from a file
C) read all file
D) read file randomly
1.6 : Difference between structure and union is
A) We can define functions within structures but not within a union
B) We can define functions within union but not within a structure
C) The way memory is allocated
D) There is no difference
1.7 : What is correct order of precedence in C?
A) Addition, Division, Modulus
B) Addition, Modulus, Division
C) Multiplication, Substration, Modulus
D) Modulus, Multiplication, Substration
1.8 : Disadvantage of array in C is
A) We can easily access each element
B) It is necessary to declare too many variables
C) It can store only one similar type of data
D) It is difficult to perform sorting operation on it
1.9 : invalid name of identifier?
A) world
B) addition23
C) test-name
D) factorial
Answer

1.10 : Due to variable scope in C
A) Variables created in a function cannot be used another function
B) Variables created in a function can be used in another function
C) Variables created in a function can only be used in the main function
D) None of the above
Answer

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one  and enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

2.1 Functions cannot return more than one value at a time.
2.2 Functions can be called either by value or reference.
2.3 Does the data type of all elements in the union will be same?
2.4  We can allocate a 2-Dimensional array dynamically.
2.5  The function free() is used to release dynamically allocated memory back to the heap for possible reuse.
2.6 If p is a pointer then the expression p = p + 1; adds 1 to the value of p regardless of p's type.
2.7 The string "Bilbo Baggins", may be stored in an array of 13 characters.
2.8 typedef is used to give a new name to a known data type.
2.9 The lifetime of a static variable is the duration of your program's execution.
2.10 Are the three declarations char **apple, char *apple[], and char appl[][] same?

Answer


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. (1x10)

X
Y
3.1
Identifiers
A.
Used to terminate loops or to exit from switch
3.2
String constant
B.
Used to bypass the remainder of the current pass through a loop
3.3
getchar()
C.
Accepts an argument which is an array of pointers to characters
3.4
rand()
D.
Accepts an argument which is a pointer to a character.
3.5
putchar()
E.
Does not retain its value once control is transferred out of its defining function
3.6
break()
F.
Allows user to define new data-types that are equivalent to existing data types.
3.7
continue
G.
Enter a character from the standard input device
3.8
Automatic variables
H.
Returns the absolute value
3.9
int p(char *a[])
I.
Initial random number generator
3.10
typedef
J.
Return a random positive integer


K.
Any number of consecutive characters, enclosed in double quotation marks


L.
Send a character to standard output device


M.
Names that are given to various program elements, such as variables.


4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Choose the most appropriate option, enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)


A.
int *p( char *a[ ] )
B.
union
C.
pointer
D.
external
E.
atoi
F.
lvalue
G.
rvalue
H.
&&
I.
ftell()
J.
parameters
K.
fseek()
L.
strcmp()
M.
int *(*p)(char(*a)[ ])





4.1 ________is a variable which holds the address of another variable.
4.2 A global variable is also known as__________variable.
4.3 ________accepts an argument which is an array of pointers to characters and returns a pointer to an integer quantity.
4.4 The argument list of function is known as function’s ________ .
4.5 C provides the ________ function to compare strings.
4.6 ________converts a character string in the form of “whitespace sign digits” to an int value.
4.7 In compiler ________ error messages means that an object on left hand side of assignment operator is missing.
4.8 ________is logical AND operator and output of AND operation is TRUE if both the operands are true.
4.9 ________sets the position to a desired point in the file.
4.10 ________, contains members whose individual data types may differ from one another.


Answer



Download PDF
Goto Next Set

No comments:

Post a Comment