GATE CSE
First time here? Checkout the FAQ!
x
0 votes
32 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 (10.8k points)   | 32 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 (379 points)  
Compile time error

Related questions

+1 vote
1 answer
1
asked in Programming by iita Active (1.3k points)   | 48 views
0 votes
1 answer
2
asked in Programming by Desert_Warrior Boss (8.6k points)   | 41 views
0 votes
1 answer
3
Top Users Jan 2017
  1. Debashish Deka

    9872 Points

  2. sudsho

    5596 Points

  3. Habibkhan

    5498 Points

  4. Bikram

    5350 Points

  5. Vijay Thakur

    4508 Points

  6. Arjun

    4458 Points

  7. Sushant Gokhale

    4410 Points

  8. saurabh rai

    4236 Points

  9. santhoshdevulapally

    3906 Points

  10. Kapil

    3892 Points

Monthly Topper: Rs. 500 gift card

19,481 questions
24,261 answers
54,211 comments
20,405 users