C Programming and Problem Solving Questions and Answers 211 to 220

C Programming and Problem Solving

Questions 211 to 220




Questions 211 to 215 are based on the code given below:
void foo (int x, int & y)
{
       int c;
       c = x + y;
       y = 2 * c;
       x = 2 * x;
}
211.
“x” and “y” are called
(a)  Actual parameters                                                          (b)  Local variables                
(c)  Formal parameters                           (d)  Local parameters                              (e)  Global variables.
212.
“c” is called
(a)  Actual parameter                                                            (b)  Local variable                                                
(c)  Formal parameter                                                           (d)  Local parameter                (e)  Global variable.
213.
The declaration “void foo (int x, int & y)”  is called a
(a)  Function body                                 (b)  Function   type 
(c)  Function stereotype                         (d)  Function prototype        (e)  Function printtype.
214.
The function “foo” returns the following type as result
(a)  Integer                                             (b)  No result is returned                              (c)  Float                
(d)  Char                                                (e)  Double.
215.
An example of a value parameter in the code above is
 (a)  x                      (b)  y                       (c)  c                       (d)  foo                              (e)  fo.
216.
C programming language was developed by
(a)  Dennis Ritchie                                  (b)  Ken Thompson                      (c)  Bill Gates         
(d)  Peter Norton                                    (e)  Donald Hearn.
217.
When a program is running the value of a constant
(a)  Can be changed                                                             (b)  Cannot be used
(c)  Is always hidden                                                             (d)  Cannot be changed             (e)  Can be used.
218.
The benefit of using enumeration data types in a program is
(a)  Program becomes shorter                (b)  Program becomes longer   
(c)  Program is easy to understand         (d)  Program executes faster
(e)  Program become complex.
219.
What is the result of the expression 6+12*3–4/2 ?
(a)  22                     (b)  25                     (c)  40                     (d)  52                              (e)  45.
220.
How many characters can a string hold when declared as char name [20]; ?
(a)  18                     (b)  19                     (c)  20                     (d)  21                              (e)  22.

Answers


211.
Answer : (c)
Reason:  The x and y are called as formal parameters  according to the definition of function.
212.
Answer : (b)
Reason:  C variable is local to the function that is why it is called to local variable.
213.
Answer : (d)
Reason:  Function prototype is the declaration of the structure of function.
214.
Answer : (b)
Reason:  No return type is mentioned
215.
Answer : (a)
Reason:  The other parameter is address parameter.
216.
Answer : (a)
Reason:  Dennis Ritchie developed C language.
217.
Answer : (d)
Reason:  The definition of constant says that it cant be changed.
218.
Answer : (c)
Reason:  Enumeration types minimize complexity.
219.
Answer : (c)
Reason:  First * is evaluated and next / is evaluated and then + or + evaluated.so 40 is the right choice.
220.
Answer : (b)
Reason:  String occupies one character as null.



No comments :

What you think about these Questions and Answers ? Let me know in comments.

Post a Comment