1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Paha777 [63]
3 years ago
8

If r is an instance of the above Person class and oddNum has been declared as a variable of type boolean, which of the following

correctly sets oddNum to true if Person object r has an odd number of children and to false otherwise?
oddNum = ( ( r.numChildren() % 2 ) != 0 );

if ( ( r.numChildren() % 2 ) == 0 )

oddNum = false;

else

oddNum = true;

oddNum = false;

for ( int k = 0 ; k < r.numChildren() ; k++ )

oddNum = !oddNum;

I only

II only

III only

I and II only

I, II, and III
Computers and Technology
1 answer:
cricket20 [7]3 years ago
4 0

Answer:

I, II, and III

Explanation:

The three are almost saying the same thing. the loop is one am a bit concerned about. but since the oddnum is set to false, the loop will work.

The one and two are pretty clear. to test for odd number, the easiest is to divide by two to see if there will be a remainder. That is what both first and second statement is trying to do.

You might be interested in
1.
Hatshy [7]

Answer:

Hi!

The following Javascript statement compares if num is 2 or 5 and increment num by 1 if true.

if ( num==2 || num==5)  

num = num +1;

Explanation:

The operator == is used to compare if the operands are equal.

The operator || is OR.

  • If at least one of the operands is true then return true.
  • If all operands are false returns false.

if( num==2 || num==5) <em> // if num is equal 2 or if num is equal 5</em>

num = num +1; <em>// adds 1 to num.</em>

8 0
3 years ago
What is the value of the variable result after these lines of code are executed?
zhuklara [117]

Answer:

result = 6

Explanation:

Just substitute the numbers for the variables:

(3*2) - (0*2) = 6

so result = 6

4 0
3 years ago
Read 2 more answers
Which example is the best demonstration of initiative?
alisha [4.7K]

Answer: In this context, the best answer for the given questions would be (B) you offer to take on some extra work when a coworker is out sick.

Explanation: Initiative is pretty much defined as an action that is taken independently by someone. It could be said that one person with an initiative does not need someone else to tell him/her to do something.

4 0
3 years ago
16 POINTS
Nostrana [21]
It think it's a Nested List.
Im so sorry if this is wrong
6 0
3 years ago
HELPPP! MARK YOU THE BRAINLIEST!
bogdanovich [222]

Answer:

My goal is to have good grades because I failing now and I want to try and try to get my grade up if I do I will be successful and when I grow up I will have a good job and a better life for me and my family.If I success my life will be so different.

5 0
2 years ago
Other questions:
  • you are a software engineering consultant and have been called in by the vice president of finance of a corporation that manufac
    10·1 answer
  • How long does it take a letter to arrive?
    9·1 answer
  • Which of the following translates packets so that the node can understand them once they enter through a port?
    7·2 answers
  • Which of the following is used to describe an authentication scenario in which a user logs in using a PIN and a security token
    7·2 answers
  • What is the term for a Web site that allows users to access and interact with software from any Internet-connected computer or d
    11·1 answer
  • What are the differences, physically and logically, between the two printing configurations: Network-attached Printing and Netwo
    7·1 answer
  • Write a program that asks the user to enter a number of seconds. There are 60 seconds in a minute. If the number of seconds ente
    9·1 answer
  • Where should citations be included in your research paper? Select all that apply.
    13·1 answer
  • After you have located a program name from the Start menu, in order to create a shortcut on the desktop.
    8·1 answer
  • What type of thinking work does the computer need to do to solve the problem?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!