Chapter 7 lesson 3

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following can be placed inside the parentheses of a switch() statement?

All of these are true

Given the following code, what will the messageText.text property contain at the end? string breakfast = "BACON"; switch (breakfast){case "bacon":messageText.text = "Mmmmmm, bacon";break;case "sausage":messageText.text = "Yummy sausage";break;default:messageText.text = "So hungry";break;}

So hungry

Given the code below, what value is stored in the messageText.text property at the end? int landing = 2;switch(landing){case 0:case 1:case 2:case 3:messageText.text = "Walk away";break; default:messageText.text = "Medic!";break; }

Walk away

What is wrong with the following code? float gamePrice = 59.99F; switch(gamePrice) { case 59.99: messageText.text = "Just right"; break; default: messageText.text = "wrong price"; break; }

You can't use a float variable or expression in a switch statement

Which of the following describes the differences between an if() and a switch() statement?

if() statements can use any logical expression; switch() statements can test one expression against multiple "equal to" values


Conjuntos de estudio relacionados

LPN to RN Transition - Fundamentals - Chapter 1: Introduction to Nursing

View Set

CITI - SoCRA - GCP for Clinical Trials with Investigational Drugs and Biologics (ICH Focus)

View Set

Gastrointestinal Practice Question

View Set

exam 2 SAMPLE QUESTIONS FROM DR .YOUAN'S LECTURE

View Set

BUSM 501 Midterm Exam Chapters 3,6,8

View Set