couple quick questions....

Which of the following options checks that city is neither Chicago nor Dallas?
Choose one answer.
a. if !(city == "Chicago" || city == "Dallas")
b. if (city != "Chicago" || city == "Dallas")
c. if !(city == "Chicago" && city == "Dallas")
d. if (city != "Chicago" || city != "Dallas")

Which one of the following statements can be used to extract the last 10 characters from the string variable str?
Choose one answer.
a. str.substr(str.length() - 10, 10)
b. str.substr(10, 10)
c. str.substr(0, 10)
d. str.substr(str.length() - 9, 10)
1) Really easy. If you don't just write out the truth tables.

2) This relies on knowledge of the substr function which you can look up on this very site.
Homework questions eh? lol

Well think about it. "||" means or and "!=" means does not equal. The if statement only initiates if the statement inside is true.
Topic archived. No new replies allowed.