Case-Based Critical Thinking Questions
??
Case 9-2
Gregor, a software developer, is developing a calendar application. He has to use severalifconditional statements to ensure that the calendar displays the exact number of days present in each month of each year. He creates adayCountarray to keep track of the number of days in each month.
?Gregor wants to create a condition to ensure that all the years divisible by 4 should contain 29 days in February. Which of the following statements should he use?
A. if (thisYear % 4 === 0) {dayCount[1] = 29;}
B. if (this year/4 === 0) {dayCount[2] = 29;}
C. if (this year*4==0) {dayCount[1] = 29}
D. if (thisYear % 4 <= 29) {dayCount[2] = 29;}
Answer: A
You might also like to view...
Integrity provides assurances that data and IT systems are not modified
Indicate whether the statement is true or false
If a client's Web browser is configured to accept cookies, the session ID is assigned to a temporary cookie named ____________________.
Fill in the blank(s) with the appropriate word(s).
What type of cloud computing service provides hardware infrastructure along with necessary operating system software for running client applications?
A. Platform as a Service B. Software as a Service C. Infrastructure as a Service D. Hardware as a Service
What is the value of balance after the following code is executed?
int balance = 10; while (balance >= 1) { if (balance < 9) break; balance = balance - 9; } A. -1 B. 0 C. 1 D. 2