1.  Find the error in the following program:
main()
{
int m;
char g;
switch(m)
{
case 3: grade=’’P’’;break;
case 2: grade=’’Q’’;break;
case 1: grade=’’R’’;break;
default: grade=’’S’’;break;
}
}
What will be the output of the program ?


Undefined symbol grade
switch statement cannot have more than three labels
case label cannot be numbers
none of these


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  goto can be used to jump from main to within a function ?


true
false
depends
varies


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

3.  How long the following loop runs ?
for(x=0;x=3;x++)


Three times
Four times
Forever
Never


Answer

 Option

The first statement of a for loop is initialize the loop counter, second is conditional statment and the third one is increment/decrement of the loop counter. In the given expression the second statement is an assignment statement instead of condition. So the for loop never execute.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

4.  What's wrong in the following statement, provided k is a variable of type int?
for(k = 2, k <=12, k++)


The increment should always be ++k
The variable must always be the letter i when using a for loop
There should be a semicolon at the end of the statement
The commas should be semicolons


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  The following statement
if (a > b)
if (c > b)
printf(‘’one’’);
else
if (c == a) printf('two');
else printf(‘’three’’);
else printf(‘’four’’);


results in a syntax error
prints four in c <== b
prints two if c <== h
prints four in a <== b


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report