C Language: Conditional Statements And Operators - Online Test

Test Difficulty Level: Medium

Syllabus of Test

C Language: Question based on Conditional Statements as - If, Else. Operators as - Greater Than, Less Than, Equal To etc.

Sample Question from this online test:

Question: main( )
{
int a = 3, b, c ;
if ( a <= 4 )
b = 3 ;
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

Option A: 3 2

Option B: 2 3

Option C: any garbage value 2

Option D: none

To answer, click the "Start This Test" button below.

Start this Test






Comments

gaurav khanna on 2009-09-13 18:00:19 wrote,

some ans are wrong Q1,Q3,Q5....................

darpan triboan on 2010-12-08 15:37:18 wrote,

Some ans are wrong....

for example

Question 17 :
main( )
{
int a = 5, b, c ;
if ( a >= 4 )
{
b = 3 ;
c = 2 ;
}
printf ( "\n%d %d", b, c ) ;
}
Option A: 3 2
Option B: 2 3
Option C: garbage value 2
Option D: garbage value garbage value
Your Answer: A
Correct Answer: D


I compiled the code and the ans was 3 2...... not "Option D: garbage value garbage value"..

dharm veer on 2011-04-05 22:40:59 wrote,

some ans are wrong right ans is here---->
q no-1.
main( )
{
int a = 3, b, c ;
if ( a <= 4 )
b = 3 ;
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

ans-->3 2
q no-3.
main( )
{
int a = 3, b, c ;
if ( a <= 4 )
b = 3 ;
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

ans--->3 2

q n0-4.
main( )
{
int a = 3, b, c ;
if ( a >= 4 )
b = 3 ;
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

ans-->any garbage value 2
q no- 7.
main( )
{
int a = 5, b, c ;
if ( a >= 4 )
b = 3 ;
else
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

ans--->3 any garbage value
q no-17.
main( )
{
int a = 5, b, c ;
if ( a >= 4 )
{
b = 3 ;
c = 2 ;
}
printf ( "\n%d %d", b, c ) ;
}

ans--->3 2
q no-18.
main( )
{
int a = 3, b, c ;
if ( a < 4 )
b = 3 ;
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

ans--->3 2

q no-19.
main( )
{
int a = 3, b, c ;
if ( a > 4 )
b = 3 ;
c = 2 ;
printf ( "\n%d %d", b, c ) ;
}

ans--->any garbage value 2

bysani nalini on 2011-04-11 09:34:25 wrote,

most of answers are wrong please replace that

sasikumar r on 2011-04-23 10:34:31 wrote,

Dear Vinit
Please check the answers before post the questions.
Blunder! What have you done! Please Explain how 3==4 ?

jaya talreja on 2011-06-04 14:29:26 wrote,

hey
question 1's answer is wrong because if condition evaluates to true so b gets the value 3 and no curly braces around if so c=2 eill also gets evaluated and thus the output will be 32.
and similar mistakes in your answers of many questions of such type in this test. so please check them once again..

suri kumar on 2011-08-14 14:15:57 wrote,

so many answers are wrong

Ramnath J on 2012-01-01 07:06:00 wrote,

Many answers seem 2 be wrong

anuj saxena on 2012-06-18 08:47:20 wrote,

sorry,there some wrong answer please check it

VINAY kumar on 2012-09-09 08:37:59 wrote,

yr poquestion post krne se pahle check kr liya kro?

monica bansal on 2012-11-22 19:09:14 wrote,

oh...fish....the answers r wrong....jst correct them

arun gupta on 2013-09-03 08:49:22 wrote,

kuch aata hai be tujhe...lol