Database [HCL Placement]: Sample Questions 1 - 1 of 1

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 1

Database

Question

MCQ▾

The type of the controlling expression of a switch statement cannot be of the type

Choices

Choice (4)

a.

short

b.

int

c.

float

d.

char

Answer

c.

Explanation

The expression used in switch statement must have an integral data type or enumerated data type. It can be arithmetic expression also, where addition or subtraction should result into a constant expression. It can be even a character or a string. But we cannot pass any float, Boolean or double values as expression in switch statement, because performing exact equality matches on float/double is very complex in nature.

Developed by: