GATE CSE
First time here? Checkout the FAQ!
x
0 votes
47 views
#include

int main()

{ char check = 'a';

switch (check)

{

case 'a' || 1: printf("Gates ");

case 'b' || 2: printf("Quiz ");

break;

default: printf("GatesQuiz");

} return 0; }

(a) Gates

(b) Gates Quiz

(c) Gates Quiz GatesQuiz

(d) Compile-time error
asked in Programming by Veteran (12.6k points)   | 47 views

1 Answer

0 votes
i think  ryt option is "D" bcoz 'a'||1 will evaluate to 1 and 'b'||2 will also evaluate to 1 so both the case will become same .

and in swicth case every case must be unique so it will generate compile time error.
answered by Junior (579 points)  
Compile time error

Related questions

+1 vote
1 answer
1
asked in Programming by iita Active (1.9k points)   | 55 views
0 votes
1 answer
2
asked in Programming by Desert_Warrior Boss (8.7k points)   | 52 views
0 votes
1 answer
3


Top Users Mar 2017
  1. rude

    5236 Points

  2. sh!va

    3054 Points

  3. Rahul Jain25

    2920 Points

  4. Kapil

    2732 Points

  5. Debashish Deka

    2602 Points

  6. 2018

    1574 Points

  7. Vignesh Sekar

    1440 Points

  8. Bikram

    1428 Points

  9. Akriti sood

    1420 Points

  10. Sanjay Sharma

    1128 Points

Monthly Topper: Rs. 500 gift card

21,551 questions
26,896 answers
61,256 comments
23,267 users