subject

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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What is the term for water wave that is created by an underwater earthquake
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
You know the right answer?
Given the following code:

if (n==2)
{
k-= 2;
}
else if (n==3)
Questions
question
Computers and Technology, 16.06.2021 05:00
question
Mathematics, 16.06.2021 05:00
Questions on the website: 13722362