Computers and Technology

Given the following code:

if (n==2)
{
k-= 2;
}
else if (n==3)
{
k-=3;
}

can be rewritten as if ()
{
;
}

where < condition > and < assignment statement > are chosen so that the rewritten code performs the same task as the original code. Assume that both n and k are integer variables. Which of the following could be used as < condition >?

I. (n == 2) || (n == 3)
II. (n == 2) && (n == 3)
III. (n >= 2) && (n <= 3)

a. 1 only
b. 2 only
c. 3 only
d. 1 and 3 only
e. 2 and 3 only

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:31, Remba
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, Braxtonw875
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
image
Computers and Technology, 23.06.2019 10:30, badpotterchris
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
image
Computers and Technology, 23.06.2019 20:10, banna01man
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
Do you know the correct answer?
Given the following code:

if (n==2)
{
k-= 2;
}
else if (n==3)

Questions in other subjects:

Konu
Mathematics, 03.09.2020 19:01