Wednesday, November 23, 2011

Multiple Choice Questions Programming Language and C/C++

Question 1:
The break statement is used to exit from
A.      a DO loop
B.      a FOR loop
C.     a SWITCH statement
D.     all of above
E.      none of above
Question 2:
In which statements, does a CONTINUE statement cause the control to go directly to the test condition and then continue the looping process?

a.      FOR and WHILE
b.      WHILE and IF-ELSE
c.       DO-WHILE and IF-ELSE
d.      While and DO-WHILE
e.      None of above

Question 3:

The advantage of a SWITCH statement over an ELSE-IF statement
a.      A default condition can be used in the SWITCH
b.      The SWITCH is easier to understand
c. Several different conditions can cause one set of statements to be executedin a SWITCH     
d. Several different statements can be executed in a SWITCH.
e. None of above.
Question No 4

The comma operator (,) is primarily used in conjunction with
a.     FOR statement  
b.     IF-ELSE statement
c.      DO-While statement
d.    All of above
e.     None of above
Question No 5

The GOTO statement is used to

a.      Permit two different expressions to appear in situation where only one expression would ordinarily used
b.      Terminate loops or to exit from a switch
c.       Alter the normal sequence or program execution by transferring control to some other part of the program
d.      Carry out a logical test and then take one of two possible actions, depending upon the outcome of a test
e.      None of above

 Question No 6

The CONTINUE statement is used to                                             

a.   Permit two different expressions to appear in situation where only one expression would ordinarily be used
b.   Terminate loops or exit from a switch

c.   Alter the normal sequence of program execution by transforming control to some other part of the program
d.   All of above
e.   None of above
Question No 7

The traditional way to create an infinite loop in C is
a.      FOR (  ;  ;  )
b.      IF (=) BREAK;   
c.       WHILE ()
d.      All of above
e.      None of above


Question No 8

The difference between the declaraction of an external variable and its definition is

a.   A declaration causes storage space to be allocated to variable while a
definition announces variables properties

b.   A declaration announces the properties of a variable while a definition also causes storage to be allocated

c.   A declaration announces the properties of a variable while definition only causes storage to be allocated

d.   A declaration uses storage space to be allocated to variable while a definition also announce its properties.
e.   None of above


Question No 9

The comma operator (,) is used to

a.   Permit to different expressions to appear in situation where only one expression would ordinarily be used                           
b.   Terminate loops or to exit from switch

c.   Alter the normal sequence of program execution by transferring control to some other parts of the program
d.   Carry out the logical test and then take one of two possible actions, depending
upon the outcome of the test
e.   None of above
Question No 10

The recursive form of algebraic formula
y=(x1 + x2 + +xn) is

a.   Y = x + n-1 xi=1

b.
Y= xn + n  xi
i=1
c.
Y=xn+xi


d.   Y = xn + n-1 i=xi
e.   None of above


 Question No 11

Which one of the following is a storage class specification in C?
a.      Automatic
b.      External
c.       Static
d.      All of  above
e.      None of above


 Question No 12

Given these variables

char ch;
short i;
unsigned long ul;
float f;
The overall type of this expression is
a.      Char
b.      Unsigned
c.       Float
d.      Double
e.      None of above


 Question No 13

What will this program display?

#include <stdio.h>
main()
{
float f;
f=10/3;
printf ("%f",f);
}

a.     3.3
b.   3.0
c.   3
d.   3.1
e.   None of above


 Question No 14

The most common use of the one-dimentional array in C is the


         a.   String                
          b.   Character  
         c.   Data               
         d.   Functions
         e.   None of above


 Question No 15

The string related function supplied by C standard library is

a. strcpy()
b. strcat()
c.   strcmp()
d.   All of above
e.   None of the above.
Question No 16

Find out the incorrect statement for strlen() function

a.   Returns the length of a string
b.   Does not count the null   terminator     
c Has general form strlen();
d.   All of above
e.   None of above


Question No 17

C provides loop constructs for performing loop operations. They are

a.   The WHILE statement
b.    The DO statement
c.    The FOR statement
d.    All of above
e.     None of above
 Question No 18


Arrays that do not have their dimensions explicitly specified are called
 a. Unsized arrays
b. Undimensional arrays
c.   Initialized arrays
d.   No size of arrays
e.   None of the above.

 Question No 19

What is wrong with the given fragment?

a.   The size of the array is not specified
b.   Declaration must have float in place of int
c.   The list must be enclosed between curly braces  
d All of the above
e.   None of the above.

  Question No 20
A variable that holds the memory address of another object is called a
 a. integer
b. pointer   
c. constant
d. memory variable
e. None of the above.

 Question No 21

C contains two special pointer operators:
a. * and &
b. * and &&  
c.   & and &&       
d.   % and &
e.   None of the above.

  Question No 22

In C, the address of m's memory location can determined by the expression

a.   *m            
b.   m&
c.   &m       
d.   m*
e.   None of the above


 Question No 23

Main() is an example of

a. library function 
b. user-defined function
b. user-defined function   
c. headerd .statement
e.  None of the above,

 Question No 24

The header file 'ctype.h' can be used for

a.   providing links to assembly language for calls
        b.   providing diagnostic and debugging assistance
c.   providing support for string handling functions
d.   providing character type identification (boolean) and translation
e.   None of the above.

  Question No 25.

The header file 'math.h* can be used for

a.   providing links to assembly language for calls
b.   providing diagnostic and debugging assistance
c.   providing support for string handling functions d All of the above
e.   None of the above.
Answers:

1.  (d)
2.  (d)
3.  (b)
4.  (a)
5.  (d)
6.  (c)
7.  (a)
8.  (a)
9.  (6)
10.  (d)
11.  (a)
12.  (c)
13.  (a)
14.  (c)
15.  (e)
16.  (a)
17.  (b)
18.  (a)
19.  (d)
20.  (d)
21.  (c)
22.  (b)
23.  (a)
24.  (d)
25.  (e)






No comments:

Post a Comment

Dear Reader, if you like My Blog content, feel free to comment on our blog posts.