GATE CSE
First time here? Checkout the FAQ!
x
0 votes
123 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 (14.8k points) 15 152 318 | 123 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 (821 points) 1 3 7
Compile time error


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23684 Points

  2. Bikram

    17288 Points

  3. Habibkhan

    9086 Points

  4. srestha

    6460 Points

  5. Debashish Deka

    5478 Points

  6. jothee

    5148 Points

  7. Sachin Mittal 1

    4910 Points

  8. joshi_nitish

    4492 Points

  9. sushmita

    4068 Points

  10. Rishi yadav

    3998 Points


Recent Badges

Photogenic arvin
Notable Question Chandramani Adil
Popular Question shaff
Popular Question makhdoom ghaya
Good Answer Arjun
Good Comment sudsho
Popular Question jothee
100 Club NEELU PANDEY
Good Answer Mehak Sharma 1
Good Question jothee
27,421 questions
35,271 answers
84,572 comments
33,506 users