C Language: Decision Control - Online Test

Test Difficulty Level: Medium

Syllabus of Test

Computer Programming: Questions about C related to decision control structures.

Sample Question from this online test:

Question: main( )
{
int i = 5, j = -1, k = 0, y, z ;
y = i + 5 && j + 1 || k + 2 ;
z = i + 5 || j + 1 || k + 2 ;
printf ( "\ny = %d z = %d", y, z ) ;
}

Option A: 1 0

Option B: 0 1

Option C: 1 1

Option D: none

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

Start this Test






Comments

Rajat Jindal on 2011-08-22 07:45:34 wrote,

answer of 20 no qustion is wrong i think it should be error....

karthik ravi on 2011-10-19 08:48:19 wrote,

C language: decision control ==>

mr.vinit, ur questions are good but there are some wrong decisions which u have picked as correct answers.

Q2: This problem will yield the result of 1011 not 1010. Actually this answer is not at all available in the options.

Q11: U r doing operations with i, j, k and l. But u have used capital i (I) to print. obviously it will give error. So here also ur answer is wrong. please check them

Q16: If the answer is A ("Not Definitely"), then what the \n is doing in the printf?

Anyway thanks for questions

vibin prasath on 2013-07-15 15:55:50 wrote,

Mr.Vinit,
There are some wrong answers for the que!
in que no 20,answer is wrong,i think its error because & is bitwise operator &&(AND) is used for comparison.
que no:16 the immediate stmt after if only will be getting executed, if there are multiple stmts then { } should be used to define.
and also in que no:2
thanks

Sohni verma on 2013-07-23 13:55:14 wrote,

some ans are wrong

vella durai on 2013-11-04 11:29:57 wrote,

Q11:
wrong answer.please checkkk