Question
QUESTION 4 Given the switch statement, which of the following would be the first if statement to replace the first test in the switch? switch
QUESTION 4
Given the switch statement, which of the following would be the first if statement to replace the first test in the switch? switch (control) { case 11 : WriteLine("eleven"); break; case 12 : WriteLine("twelve"); break; case 16 : WriteLine("sixteen"); break; }
if (case = 11) | |||||||||||||||||
if (case == 11) | |||||||||||||||||
if (control == 11) | |||||||||||||||||
if (switch == 11) | |||||||||||||||||
none of the above QUESTION 5 If you were to write switch statements to perform the following evaluation, what selector would be placed inside the parenthesis for each of the following scenarios? switch ( ? ) a. Testing string stateName for FL, GA, or MS. Storing 1 in cnt for FL, 2 for GA, 3 for MS b. Testing cnt for 1, 5 or 7. Storing 100 in value1 when cnt is 1, storing 10 in value1 when cnt is 5 and storing 1 in value1 when cnt is 7 c. When middleInitial is equal to the character z, a message should be displayed stating Youre one in a thousand; otherwise, check to see if it is equal to the character a. When it is equal to the character a, display the message You have the most common initial. If its not equal to a or z the message should read Just another initial. QUESTION 6 What is the result of the following conditional expression when aValue = 100 and bValue = 7 ? result = aValue > bvalue + 100 ? 1000 : 2000;
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started