Daily Quizzes
Mock Tests
Download MCQs Free PDF
Question
Computer Knowledge

In C programming body of a switch statement must consist of:

A case labeled statement

default labeled statement

A statement

A loop

C प्रोग्रामिंग में, स्विच स्टेटमेंट की बॉडी में ये चीज़ें होनी चाहिए:

एक केस-लेबल वाला स्टेटमेंट

डिफ़ॉल्ट-लेबल वाला स्टेटमेंट

एक स्टेटमेंट

एक लूप

View Answer & Solution
Correct Answer: A (A case labeled statement) A (एक केस-लेबल वाला स्टेटमेंट)
Detailed Solution:

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.

Syntax

switch(expression) {

case constant-expression :

statement(s);       break; /* optional */            

default : /* Optional */

statement(s);

}

स्विच स्टेटमेंट किसी वेरिएबल की वैल्यूज़ की लिस्ट के साथ समानता (equality) की जाँच करने की सुविधा देता है। हर वैल्यू को 'केस' कहा जाता है, और जिस वेरिएबल पर स्विच किया जा रहा है, उसकी जाँच हर स्विच केस के लिए की जाती है।

सिंटैक्स

switch(expression) {

case constant-expression :

statement(s); break; /* वैकल्पिक */

default : /* वैकल्पिक */

statement(s);

}

India’s #1 Learning Platform
Start Complete Exam Preparation
Daily Live MasterClasses
Practice Question Bank
Mock Tests & Quizzes
Trusted by 8.1 Crore+ Students

Exam Preparation Simplified

Learn Practice Analyse Improve
Get Started Free
Download the App

Trusted by 8.1 Crore+ Students

Enquire Now

Please share a few details to view the answer and solution.

×
Illustration of two people having a discussion

We're Here for You! Get in Touch with Class24 for All Your Needs!

Disclaimer: Your privacy is important to us. We will not share your information with third parties.