Wednesday, January 30, 2019

M3-R4: Programming & Problem Solving Through 'C' Language January 2019

PART ONE
(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.1 Which of the following is the correct order of evaluation for the below expression?
(A) */%+-=
(B) =*/%+-
(C) /*%-+=
(D) *%/-+=
Answer

1.2 Which of the following is true for variable names in C
(A) They can contain alphanumeric characters as well special characters.
(B) It is not an error to declare a variable to be one of the keyboards (like goto, static)
(C) Variable names cannot start with a digit
(D) Variable can be of any length
Answer

1.3 What is the output of this C code?
 #include<stdio.h>
 int main()
 {
     int x=2,y=0;
     int z=y&&(y\=10);
     printf(“%d\n”,z);
     return 0;
 }
(A) 1
(B) 0
(C) undefined behavior due to order of evaluation
(D) 2
Answer

1.4
 main()
 {
     int i=1;
     while()
     {
         printf(“%d”,i++);
         if(i>10)
         break;
     }
 }
(A) The condition in while loop is must
(B) There should be a semicolon in the while loop
(C) The while loop should be replaced by for loop
(D) No error
Answer

1.5 What is right way to initialize arrays ?
(A) int num[6]={2,4,12,5,45,5};
(B) int n[]={2,4,12,5,45,5};
(C) int n[6]={2,4,12};
(D) int n[6]={2,4,12,5,45,5};
Answer

1.6 What will be the output of the following program?
    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 array
(C) Base address of array
(D) Address of the last element of array
Answer

1.7
 #include<stdio.h>
 void fun(int *ptr)
 {
     *ptr=30;
 }
 int main()
 {
     int y=20;
     fun(&y);
     printf(“%d”,y);
     return 0;
 }
The output of above program is
(A) 20
(B) 30
(C) Compiler error
(D) Runtime error
Answer

1.8 If the two strings are identical, then strcmp() function returns
(A) -1
(B) 1
(C) 0
(D) infinity
Answer

1.9 What is the maximum number of dimensions an array in C may have ?
(A) 2
(B) 8
(C) 20
(D) Theoretically no limits. the only practical limits are memory and compilers
Answer

1.10 Is the following statement declaration or definition:
extern int i;
(A) Declaration
(B) Definition
(C) Function
(D) Error
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.

2.1 The expressions *ptr++ and ++*ptr are same
2.2 C provides the strcmp() function to compare strings
2.3 A function cannot be defined inside another function.
2.4 Goto can be used to jump from main function to other function.
2.5 The default parameter passing mechanism is call by value.
2.6 The expressions arr and &arr same for an array of 10 integers
2.7 Memory allocation can be done by using keyword „create‟.
2.8 The expressions int fun(int arr[]); and int fun(int arr[2]); are same.
2.9 There can be two return statements inside a function.
2.10 Break statement can be used to exit a loop.
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.

X Y
3.1 For is A. is another name for a variable
3.2 Float B. more priority than +
3.3 Reference C. cannot return array
3.4 # define directive D. is not a correct variable type
3.5 enum is E. an entry controlled loop
3.6 Function F. is used to signal the beginning and end of code blocks
3.7 Logical OR Operator G. defines a macro
3.8 *has H. is a keyword
3.9 Real I. function all C programs must contain
3.10 Comments in C J. is the correct operator to compare two variables
K. user defined data types
L. /* */
M. ||
Answer

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.

A Return B Global C Sequential
D Infinite E do-while F Union
G Null H Ternary I integer
J Pointer K Auto L prototype
M Argument

4.1 An array elements are always stored in _______________ order.
4.2 The value obtained in the function is given back to main by using _______ keyword.
4.3 By default, storage class of local variable is _________.
4.4 _________ loop can be terminated using break statement.
4.5 __________ is a variable which holds the address of another variable.
4.6 Variables that are alive and active throughout the program are called _________ variables.
4.7 _________ is an exit control loop.
4.8 A pointer that does not point to any data object is _________.
4.9 The conditional operator ( ? : ) is a ___________.
4.10 In _________ all elements are stored in the same memory location.
Answer
    Part two

No comments:

Post a Comment