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
Bond [772]
3 years ago
7

Given the following code segment, what is output after "result = "? int x = 1, y = 1, z = 1; y = y + z; x = x + y; cout <<

"result = " << (x < y ? y : x) << endl;
a. 2
b. 3
c. 4
d. 1
Computers and Technology
1 answer:
Katyanochek1 [597]3 years ago
4 0

Answer:

The answer is "Option b".

Explanation:

  • In the C++ language program code, there are four integer type variable is defined that is "x, y,z, and result" in which variable x,y,z holds a value that is "1" and the variable result does not hold any value.  
  • In the next line, variable y holds added value of variable y and z, which is equal to 2. and variable x holds added value of variable x and y, which is equal to 3.
  • In the next line, a Ternary Operator is defined, it is similar to an if-else statement. This operator checks if x variable value is less then y. If this condition is true, it will print y variable value Otherwise, it will print x variable value. That's why the out to this question is "option b".
You might be interested in
What is a valid response when identity theft occurs
Alexxandr [17]

Answer:

Unsecure Passwords

4 0
3 years ago
Consider a Rational class designed to represent rational numbers as a pair of int's, along with methods reduce (to reduce the ra
Shtirlitz [24]

Answer:

There is not a reason for the two methods to be private unless you want to only allow objects of the class Rational to have access to these methods.  Perhaps your professor has a particular reason for requiring it to be set up as such.

Explanation:

The use of the private space simply restricts access to either variables or methods contained within the space to the class object that is associated with the variable or methods.

The use of the public space allows the method or variable to be accessed from anywhere within the program.

Note, if using class inheritance, classes that inherit from the Rational class will not be able to access the private functions.

8 0
3 years ago
After a file downloads, you can do any of the following except
loris [4]
Change owner rights... I think you forgot to put the choices, I am taking a wild guess of what the answers could have been.
8 0
3 years ago
What does this road sign mean?
serious [3.7K]

Answer:

Speed limit 50 ahead

Explanation:

6 0
3 years ago
Read 2 more answers
Why is it important to be a good digital citizen? 2-3 sentences
weqwewe [10]

Answer:

It's nice to be a good digital citizen because you'll stay out of trouble. It will help make someone's day without any negativity. It helps ensure that there is no cyberbullying occuring.

6 0
3 years ago
Read 2 more answers
Other questions:
  • In a database list, fields are displayed as _____. rows columns tables records
    10·1 answer
  • What ip address cidrs are not allowed to be communicated with by our malware?
    15·1 answer
  • A ____ is a battery-operated power source directly attached to one or more devices and to a power supply (such as a wall outlet)
    14·1 answer
  • The _____ element of the wsdl describes the data being exchanged between the web service providers and the consumers, including
    12·1 answer
  • Anyone Free to Talk??????? I'm Bored :(
    6·2 answers
  • Would a hurricane form if the humidity is really high and the breeze is very low
    11·1 answer
  • When is the kids choiceee awads?????????????????????????
    12·2 answers
  • Anybody got a quisten
    12·1 answer
  • Is this a desktop or a computer, or are they the same thing
    12·1 answer
  • How does a python programmer concatenate a numeric value to a string value?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!