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

Related questions

+1 vote
1 answer
1
asked in Programming by iita Active (1.9k points)   | 61 views
0 votes
1 answer
2
asked in Programming by Desert_Warrior Boss (8.9k points)   | 61 views


Top Users Jun 2017
  1. Bikram

    3810 Points

  2. Arnab Bhadra

    1526 Points

  3. Hemant Parihar

    1502 Points

  4. Niraj Singh 2

    1491 Points

  5. Debashish Deka

    1434 Points

  6. junaid ahmad

    1432 Points

  7. pawan kumarln

    1278 Points

  8. Rupendra Choudhary

    1242 Points

  9. rahul sharma 5

    1236 Points

  10. Arjun

    1218 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 Jun 26 - Jul 02
  1. pawan kumarln

    410 Points

  2. Arjun

    258 Points

  3. akankshadewangan24

    254 Points

  4. Abhisek Das

    220 Points

  5. Debashish Deka

    188 Points


23,421 questions
30,139 answers
67,562 comments
28,469 users