C Programming and Problem Solving Questions and Answers 11 to 20

C Programming and Problem Solving

Questions 11 to 20


11.
Which command is used to skip the rest of a loop and carry on from the top of the loop again?
(a)  Break;               
(b)  Resume;                                          
(c)  Continue;          
(d)  Skip                  
(e)  None of the above.

12.
How would you declare a constant of 5 called "MYCONST"?
(a)  constant MYCONST = 5;                  
(b)  int myconst = 5;
(c)  #define MYCONST 5                        
(d)  constant = 5
(e)  #define MYCONST=5.

13.
Which of the following is not a storage class in C?
(a)  Auto                  
(b)  Struct                
(c)  Extern               
(d)  Static                
(e) Register.

14.
What is the fifth element of the array int a[3][4]={1,2,3,4,5,6,7,8,9,10,11}; ?
(a)  4                       
(b)  6                       
(c)  5                       
(d)  7                       
(e)  3.

15.
What is the output of the following program?   
#include<stdio.h>
int c [10]={1,2,3,4,5,6,7,8,9,10};  
       main ()
      { int a,b=0;
        for(a=0;a<10;++a)
if(c[a]%2= =1)
 b+=c[a];
 printf (‘%d”, b);}

(a)  20                     
(b)  24                                                   
(c)  25                    
(d)  30                     
(e)  None of the above.

16.
int a [5]={1,2,3}  what is the value of  a[4]?
(a)  3                       
(b)  1                       
(c)  Garbage value  
 (d)  0               
(e)  2.

17.
Information will be passed to the function via special identifier is called
(a)  Arguments                                       
(b)  Parameters        
(c)  Both (a) and (b) above                    
(d)  Elements                                         
(e)  Characters.

18.
Which of the following function returns multiple values?
(a)  Printf( )              
(b)  Scanf( )                                           
(c)  Printf( ) & scanf( )
(d)  Getch( )            
(e)  None of the above
.
19.
What is the associatively of the conditional operator?
(a)  Left to Right                                    
(b)  Right to Left                          
(c) Top to Bottom
(d)  Bottom to Top                                 
(e)  None of the above.

20.
What is the output of the following statement?
Printf(“%v”, 12);
(a)  12                                                   
(b)  12.0                                                
(c)  %v                         
(d)  Garbage value                                 
(e)  None of the above.

Answers


11.
Answer : (c)
Reason:  Continue statement is used to skip the rest of the statements in a loop and carry from the top of the loop again.
12.
Answer : (c)
Reason:  #define statement is used.
13.
Answer : (b)
Reason:  Struct is not a storage class in C language.
14.
Answer : (c)
Reason:  In the two dimensional array representation there will be 3 rows and 4 columns. The elements are stored in row wise first. Hence the fifth element is 5.
15.
Answer : (c)
Reason:  The remainder is 1 for only 1, 3, 5, 7, 9 numbers and the sum of these four numbers is 25.
16.
Answer : (c)
Reason:  In the fourth location of an array contains garbage value since we are storing only three elements in the first three locations.
17.
Answer : (c)
Reason:  We can call them as function arguments or parameters.
18.
Answer : (b)
Reason:  Scanf() function returns multiple values.
19.
Answer : (b)
Reason:  Right to left is the operator associativity  for the conditional operator.
20.
Answer : (c)
Reason:  The control string %v is printed.


<< Prev 1...  2...  3...  4...  5...  6...  7...  8...  9...  10...  11... 12...  13...  14...  15...  16...  17...  18...  19...  20...  21...  22...  23...  24...  25...  26...  27...  28...  29...  30...  31...  32...  33...  34...  35...  36...  Next >>



7 comments :

  1. 16 will print 0 and 20 will print v

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete

  3. There are times when people are having lots of trouble while they are planning to update AOL Desktop gold in their computer. If you are also one of them, you need first to see whether your system is fulfilling all the requirement which is required for downloading the software.

    ReplyDelete
  4. Wonderful post, Thank you! This article very useful for us. For any help regarding Any Job Updates follow these link:-
    Latest Jobs Updates

    ReplyDelete
  5. Very informative set of questions and answers! This really helps clarify some key concepts in C programming. Thanks for breaking it down so clearly.
    Calculatera


    ReplyDelete
  6. You have a unique way of turning the ordinary into something extraordinary. I highly recommend the Mental Age Test Online for anyone curious about their cognitive development.

    ReplyDelete