/> M3-R4: PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE JULY 2018

M3-R4: PROGRAMMING & PROBLEM SOLVING THROUGH ‘C’ LANGUAGE JULY 2018

M3-R4: PROGRAMMING & PROBLEM SOLVING 
THROUGH ‘C’ LANGUAGE JULY 2018

Q.1. Multiple Choice of Answers.

1.1 Which programming method is followed in C language 
a) Algorithm 
b) Flow-Charts 
c) Procedural 
d) Object Oriented 

1.2 getchar() function is available in which header file? 
a) Stdio.h 
b) Conio.h 
c) Math.h 
d) Header.h 

1.3 Find the output of following code : 
 int main() {
 int i=-2;
 printf (“-i=%d”,-i); return b;
a) –i=2 
b) i=-2
c) –i=-2 
d) –i=+2 

1.4 Which numbering system is not handled directly by the printf() conversion specifies ? 
a) Decimal 
b) Binary 
c) Octal 
d) Hexadecimal 

1.5 Which of the following is an incorrect assignment statement ?
A) N=m=0
B) Value+=10
C) mySize=x<y?9:11
D) Value=+=10

1.6 What will be the output of following program?
int main() {
int x=5;
printf(“%d %d %d”,x,x<<2,x>>2);
 }   
A) 1 20 5
B) 5 1 20
C) 5 20 1
D) 20 1 5   

1.7 A programming construct in which a set of statement in a computer program can be executed repeatedly.
A) Loop statement
B) Conditional statement
C) Block statement
D) All of the above

1.8 What will be the output of following program?
int main()
{ for(int c=1;c<=5;++c);
 printf(“%d”,c);
}
A) 1
B) 5
C) 6
D) 12345

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

How many times is a do while loop guaranteed to loop?
A) 0
B) Infinitely
C) 1
D) Variable
                                          
Q.2. TRUE or FALSE.

2.1 Function can be called either by value or reference
TRUE

2.2 A function cannot be defined inside another function.
TRUE

2.3 Are the three declarations char **apple, char *apple[], and char apple[][] same? FALSE

2.4 A long double can be used if range of a double is not enough to accommodate a real number.
TRUE

2.5 malloc() allocates memory from the heap and not from the stack.
TRUE

2.6 While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.
FALSE

2.7 A union cannot be nested in a structure
FALSE

2.8 The modulus operator cannot be used with a long double.
TRUE

2.9 If the file to be included doesn‟t exist, the preprocessor flashes an error message. TRUE

2.10 A linked list is a linear data structure where each element is a separate object. TRUE
                                                   

   Q.3. Match words and phrases


SR NO.
X
Y(Ans.)
1
Calls itself
2
String copy
3
3 Unary operator
4
while(2)
5
Structure
6
realloc
7
exit()
8
Typecasting
9
‘\v’ used for
10
Array is a


Q.4. Fill in the blank

4.1 Function ___(E) fputs________ writes a line to a specified file

4.2 Pictoral representation of an algorithm is _____(D) Flowchart__________

4.3 A variable can be made constant by declaring it with the qualifier ___(A) Const___ at the time of initialization

 4.4 The __(J)sizeof______ Operator returns the number of byte the operand occupied.

4.5 By default, the real numbers are printed with a precision of ___(G) Six________ decimal places.

4.6 The _____(H) break____ statement when executed in a switch statement causes immediate exit from the structure

4.7 The _____(B) continue_________ statement is used to skip a part of the statement in a loop.

4.8 An array that used more than two subscript is referred to as___(K) Multi-dimensional___ array.

4.9 After incrementing a float pointer ptr by 1 it would be incremented by _(I) 4 Bytes_______________

4.10 The ______(L) *___________ operator returns the value of the variable to which its operand points

Options.
A. Const
B. continue
C. Two-dimensional
D. Flowchart
E. fputs
F. 2 bytes
G. six
H. break
I. 4 bytes
J. sizeof
K. Multi-dimensional
L. *
M. &

Long Questions

(Answer any four questions)
Q.5. 
a) Write a ‘C’ program to display following pattern:
A
B B
C C C
D D D D
E E E E E
b) Write a 'C' program that displays the recommended actions depending on the color of a traffic light using the switch statement.
c) What is function? Explain uses of function. Also, explain declaration, function call and function definition with example.
(4+4+7)

Q.6.
a) Write a ‘C’ program to find the frequency of characters in a String.
b) Write a ‘C’ program to store information (title, author, subject and book_id) of a Book using structure and display it in appropriate format.
c) Write a ‘C’ program to find largest element of an Array.
(5+5+5)

Q.7.
a) Draw a flowchart to find the Fibonacci series till term ≤ 1000.
b) Explain different storage classes available in ‘C’.
(7+8)

Q.8.
a) Explain about ‘pointer to function’ with suitable example.
b) What are the advantages and disadvantages of an Array? c) Write a 'C' program to copy text of one file to another file.
(5+5+5)

Q.9.
a) What is command line argument? Also, explain how to pass command line arguments to ‘C’ program. b) What are preprocessor directives? Why do we need them? Explain various preprocessor directives?
c) Explain the difference between Text Mode and Binary Mode files.
(5+5+5)



2/Post a Comment/Comments

Leave a Reply

Post a Comment

Leave a Reply

Previous Post Next Post