What is a ternary operator? Explain with the help of an example.
The ternary operator deals with three operands. It is also known as a conditional operator. In this operator, the value of the variable depends on the logical expression.
Example:
int a = 5:
int b = 3;
int max = (a > b)? a : b;​

Answers

Answer 1
Answer:

A ternary operator, also called a conditional operator, is a special kind of operator used in some programming languages as a shorter way of writing an if..else block. It is denoted by a question mark and then a colon (? : ). It takes 3 operands:

i. A boolean expression which would evaluate to a true or a false.

ii. A first value that will be assigned if the boolean expression gives a true.

iii. A second value that will be assigned if the boolean expression gives a false.

The general format is:

variable = boolean expression ? first_value : second_value;

For example:

A ternary expression can be written as;

String f = (3 > 5) ? "yes" : "no";

In the above expression;

The boolean expression is 3 > 5

The value to be assigned, to f, if the boolean expression is true is "yes"

The value to be assigned, to f, if the boolean expression is false is "no"

So in this case, since (3 > 5) evaluates to false, "no" will be assigned to f.

Therefore, the above expression will give the same result as;

String f = "no"

Another example:

=================

int a = 5:

int b = 3;

int max = (a > b)? a : b;​

==================

In the above code snippet,

Since a > b i.e 5 > 3, the first value a (which is equal to 5) will be assigned to max.

Therefore, int max = 5.

The value of max is 5

PS:

These examples and explanations are given using Java. Similar scenario, maybe different syntax, will be obtainable in other programming languages.


Related Questions

true or false: erosion takes very long to happen.​

Answers

the answer is true. erosion takes place over time

Answer:

True

Explanation:

By definition, erosion is the gradual destruction or diminution of something.

1) Erosion can take many forms

2) The 3 main types of erosion are water, wind, and ice

3) The process of erosion can take up to thousands of years

4) Erosion affects humans because it creates dust that pollutes the air and on average carries around 20 different diseases including anthrax and tuberculosis

What are your thoughts about this re-designed Logo? Is it good? Or is poorly designed? Explain your answer below.

Answers

Answer:

It is good but the back is not good enough.

Which statement best describes the problem statement below?

Vision: We want to decrease errors in our billings to clients.

Issue: Clients complain that they receive multiple bills for the same month. We have one software that keeps track of services made to clients, another software that keeps track of the charges of those services, and another software that bills the clients.

Method: Print out services and charges, and enter these values into a billing software.
This problem statement is a clear, well-defined problem statement.
This problem statement does not clearly define the issues.
This problem statement will help stakeholders participate in addressing the problem.
This problem statement does not provide a useful statement of method.

Answers

Answer:

B

Explanation:

This problem statement does not clearly define the issues.

Answer:

B

Explanation:

Tommy loves taking care of homing pigeons. He sent a note to his crush who lives 24.0 km away from his house. These birds fly at a rate of 48.2 km/h. How long will the note reach Tommys crush?​

Answers

Answer:

0.5 hours or 1800 seconds.

Explanation:

Given the following data;

Distance = 24km

Speed = 48.2 km/h

To find the time;

Time = distance/speed

Time = 24/48.2

Time = 0.50 hours

Converting the time to seconds;

1 hour = 3600 seconds

0.5 hour = 1800 seconds

Therefore, it would take 1800 seconds or 0.5 hours for the note to reach Tommy's crush.

Using the speed - distance relationship, it will take the pigeon about 29.88 minutes to reach Tommy's crush.

Given the Parameters :

Speed of pigeon = 48.2 km/hr

Distance to be covered = 24 km

Recall the Time taken relation :

Time taken = (Distance ÷ Speed)

Time taken = (24 ÷ 48.2) = 0.4979253 hours

Converting to minutes :

0.4979253 × 60 = 29.875 minutes

Therefore, it will take the pigeon about 29.88 minutes to reach her destination.

Learn more : https://brainly.com/question/23313999

Claudette is shocked to discover that her company's data has been stolen, and their Web site shut down, by a malicious ex-employee. She had thought their security was airtight! Two recent changes they made were migrating their database to a private, on-premises cloud and installing IoT devices that communicate with the database continually. What most likely occurred

Answers

Answer:

The answer is "Ex-employee hack IoT firms from Claudette to access them".

Explanation:

Computer system hacking is only a breach between both the access as well as the stealing or misuse of critical information between both computer software from the target system. In this sense, a malicious attacker uses a computer device or even a network to access or illicitly exploit information.

Write the output of the following program:

CLS

a=20

FOR x = 1 to a

IF x MOD 2 < > 0 THEN

S S+x

END IF

NEXT X

PRINT S

END​

Answers

Answer:

Expression A

Explanation:

In this Pseudocode, the output would be 100. This is because the code is looping from 1 to 20 and adding together all of the odd numbers between 1 and 20. Since it is checking to make sure that the remainder of each number is not equal to 0 which would indicate an odd number, and if it is odd then it adds it to the variable S. Therefore, the odd numbers between 1 and 20 are the following...

1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 = 100

write any two web browers​

Answers

Answer:

G00gle and bing

Explanation:

The Dark Web is _____. Select 2 options.

an international marketplace where criminals buy and sell products

an international marketplace for illegal trade only

a capitalistic marketplace for criminals and noncriminals

a network of cybercriminals organized from Europe and the US

a local marketplace to trade intellectual property

Answers

Answer:

a. an international marketplace where criminals buy and sell products.

c. a capitalistic marketplace for criminals and non-criminals.

Explanation:

In computing, WWW simply means World Wide Web. The world wide web was invented by Sir Tim Berners-Lee in 1990 while working with the European Council for Nuclear Research (CERN); Web 2.0 evolved in 1999. Basically, WWW refers to a collection of web pages that are located on a huge network of interconnected computers (the Internet). Also, users from all over the world can access the world wide web by using an internet connection and a web browser such as Chrome, Firefox, Safari, Opera, etc.

In a nutshell, the world wide web (www) is an information system that is generally made up of users and resources (documents) that are connected via hypertext links.

The dark web also referred to as darknet, can be defined as a subset of the world wide web that is intentionally encrypted from conventional web browser and search engines. Thus, it is a peer-to-peer network that requires the use of specialized configuration and web browser such as "Tor browser" in order to access its contents.

Generally, all the internet activities carried out on the dark web are anonymous and private, thereby making it suitable for either legal or illegal operations. Also, it's devoid of government influence or control and as such it's typically a capitalistic marketplace, where goods and services are privately owned and controlled by the people.

Hence, we can deduce that the dark web is simply;

I. An international marketplace where criminals buy and sell their products.

II. A capitalistic marketplace for criminals and non-criminals.

Answer:

an international marketplace where criminals buy and sell products

a capitalistic marketplace for criminals and noncriminals

Explanation:

Ed22

Select the correct answer.
What type of media is/are only used for one-time backups?
A.
internal hard disk
B.
external hard disk
C.
DVD, optical media, and removable media
D.
remote shared folder
E.
tape

Answers

Answer:

E

Explanation:

Answer:

It's D I promise

Explanation:

i did it! D is right

what is the decimal value for the jump control?

Answers

Answer:

24

Explanation:

11000 is equivalent to 24 because if you look at a flippy do, the base is 2. so going from right-left, 2^0 is 1 for the first 0. second zero would be 2^1 which is 2. then the third zero is 4 (2^2). since they are zero’s, they are turned off, but the 1’s indicate that those bases are turned on. the first one going from right to left would then be 8 (2^3) and the last 1 going from right-left is 16 (2^4). so 16+8=24!

edit: didn’t mean to rate myself 1 star lol

why is information called a resource​

Answers

Answer:

Explanation:

Information is a resource due to its nature of limited availability, usefulness and its reliability when making references to it.

Answer:

Information is a resource due to its nature of limited availability, usefulness and its reliability when making references to it.

On the Direct Marketing worksheet, create appropriate range names for Design Fee (cell B8), Cost Per Ad (cell B9), Total Clicks (cell B10), Profit Per Click (B11), and Gross Profit (cell B12).

Answers

Answer:

See explanation below

Explanation:

Named ranges are a very important tool in Microsoft Excel. It is used in assigning a name to a particular number of cells. It is great for automation and makes formula much easy to understand and use.

One way to create named ranges is theory the Name Box.

To create named ranges in the design marketing sheet we do this;

1) We click on cell B8 and then navigate to the name box at the top right corner of the sheet just above the column A.

•The name box is where the cell address of any cell that is active is displayed.

•You would see that “B8” is displayed on the name box.

• Double click on the name box and type in the appropriate name, in this case - Design_Fee.

• Press enter and you have your named range.

You do the same for the other named ranges.

Note that: Named ranges must contain letters, numbers or underscore.

In a voice over IP setup (VoIP), what kind of device converts signals from a campus's analog phone equipment into IP data that can travel over a phone company's analog telephone lines

Answers

Answer:

VoIP gateway

Explanation:

A VoIP stands for the voice over IP. The VoIP gateway is defined as a hardware device which is used to convert the telephony traffic into the packets of data that is used for transmission over the internet. It acts as the bridge and connects the VoIP with the worlds of the legacy telephony.

In a VoIP setup, the signals form the analog phone of the campus equipment  are converted to the IP data which can travel over the analog telephone lines of the phone company.

For the situation below, determine whether the premium will likely increase, decrease, or remain the same.

Kamiah passes a driver’s education course.

Answers

Answer:

decrease

Explanation:

How can learning opportunities for AI be extended to all

Answers

Answer:

Learning opportunities for AI can be extended to all through the inclussion of courses and different teaching methods related to Artificial Intelligence, new technologies, computer science, programming and, in short, everything related to the digital world, in the educational plans at the national level. This is so because artificial intelligence and computer systems are the basis for the development of the new tools jobs of tomorrow. Thus, education in these subjects is essential so that citizens can enter the labor market once they acquire the necessary age, having the knowledge to do so in a proper way.

Multiple
Choice
What will be the output?
class num:
def __init__(self,a):
self. number = a
def_mul__(self, b)
return self.number + b.number
numA = num(5)
numB = num(10)
product = numA * numb
print(product)
50
O 5
an error statement
15

Answers

Answer:

15

Explanation:

Edge 2021

How do I make a game from scratch, what program should I use, and what tutorial should I follow, I want to make a 2D platformer with some 3D elements in there.

Answers

Honestly just buy a decent GUI and gets scripts for other games and piece it together it’s how was made

Write a program that repeatedly asks the user to type in an integer until they input a multiple of 7

Answers

Answer:

 See the code in the explanation below

Explanation:

For this excersie we are going to be using C++, if you want me to produce the code in another language do let me know

// Online C++ compiler to run C++ program online

#include <iostream>

using namespace std;

int main()

{

int Number;

   do

{

 cout <<"Enter a  multiple of seven: ";

 cin >> Number;

 

 if(Number%7 == 0 ){

     cout<<"correct!!! the number is a multiple of seven";

 

 }

} while(Number%7 != 0);

}

   

   

 

   

   

   

   

       

can some one tell me how to screen shot on a pc computer

Answers

Answer:

click 'prt sc' which is print screen.

and then save it somewhere..like paint or something and DONE.

thenks for the points btw.

Answer:

You just press the (Win+PrtSc) key.

Or sometimes you just have to press the (PrtSc) key

What is a variable in programming?
1) A symbol or set of characters in a programming statement whose value can
be changed
2) A symbol in a mathematical equation
3) The characters that make up a string
4) The output when code is printed

Answers

A symbol or set of characters in a programming statement whose value can be changed

What is a product line

Answers

Answer:

A group of products that are similar in many ways, but usually spec'd out uniquely to target different applications or customers.

Web design incorporates several different skills and disciplines for the production and maintenance of websites. Do you agree or disagree? State your reasons.

Answers

Answer:

Yes, I do agree with the given statement. A further explanation is provided below.

Explanation:

Web design but mostly application development were most widely included throughout an interchangeable basis, though web design seems to be officially a component of the wider website marketing classification.Around to get the appropriate appearance, several applications, as well as technologies or techniques, are being utilized.

Thus the above is the right approach.

chnology
Submit Test
Reader Tools
35
Select the correct answer.
For an entry-level worker in the web and digital communications pathway, which educational qualification would be needed to move to the
position of a multimedia designer or web developer?
A. high school diploma
B. certificate diploma
C. associate's degree
D.
doctoral degree
E.
bachelor's degree
Undo
Next

Answers

Answer:

Option B

Explanation:

For an entry level worker in the web and digital communications pathway, a certificate course is only required.

Graduation, post-graduation and doctoral degrees are required for higher roles and research works.

Hence, option B is correct

Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up for a very large company of approximately 100,000 customers

Answers

Answer:

Task A

Explanation:

Hannah's prior status updates, pictures, and profile data will be hidden from view and deleted from servers 30 days after posting.

What amount of time when scaled up large company?

When a set of symbols is used to represent a number, letter, or word during coding, that symbol, letter, or word is said to be being encoded. The collection of symbols is referred to as a code. A set of binary bits is used to represent, store, and transmit digital data.

Binary code is another name for this category.The values of the subject attributes can be stored in numerous rows for large data subjects. Data from long data sets may span several columns.

Therefore, The only system that is adaptable enough to allow for the representation of data other than numbers is the binary number system.

Learn more about scaled up here:

https://brainly.com/question/28966944

#SPJ2

Can you move it like this? I can shake it like that
Can you move it like this? I can shake it like that
Can you move it like this? I can shake it like that
C'mon ladies rock the party Shake your body everybody

C'mon everybody
Let's move it all night
Gonna take you back to the old school
Can u feel the vibe
Just dance to the rhythm and let me
See ya wind your waistline
Jump back and the do the twist
And the electric slide yeah
(Move it man)
Can you move it like this? I can shake it like that
Can you move it like this? I can shake it like that
Can you move it like this? I can shake it like that
C'mon fellas rock the party Shake your body everybody

Lets get funky do the? sound
And say here we get on the floor and do it like this

Can anyone do the Double Bump?
Like back in the day
We thought we'd bring it to ya
Baha Men keep it groovin' yeah yeah
Well I can see everybody on the floor
Doing the running man
Do the mash potato
Or walk the Philly Dog if you can
Yeah
(Move it man)
Can you move it like this? I can shake it like that
Can you move it like this? I can shake it like that
Can you move it like this? I can shake it like that
C'mon y'all let's rock the party Shake your body everybody

Remember back in the day
When we used to dance the Boogaloo
Everybody used to rock the beat
Solid Gold kickin' up too
And everybody rock together with the DJ when he plays
Smooth music is kickin' clippin'
We rush back and we keep dippin'

C'mon baby let's rock let's rock
We gonna get up on the dance floor and do the Pee wee Herman
So shake it up
And do the bus stop
And do the Robot
And baby do the rock yeah
(Move it man)

Can you move it like this? LA! I can shake it right back
Atlanta!
Can you move it like this? New York! I can shake it right back
Whazzup!
Can you move it like this? Seattle! I can shake it right back
Dallas and Houston!
C'mon y'all let's rock the party Shake your body everybody

Answers

Answer:

okkkkkkkkkkkkk???

Why do you think there is a difference between good, clean designs compared to the bad, cluttered designs below?.

Answers

Answer:

Good, clean designs depicts the logic link of the company and easy to remember as compared to the bad, cluttered designs

Explanation:

The major difference between the good, clean designs and the bad, cluttered designs is that the good, clean designs depicts the logic link of the company and it is easy to remember such symbols but in case of bad, cluttered designs it is not that easy to find the logic link and also it is difficult to remember the logo.


2. According to the U.S. Department of Labor Statistics, which field of drafting has the highest median
salary:
a.Architectural
b.Mechanical
c.Electronics
d. Radiological

Answers

it is c it’s always the right answer

waluigi for smash who agrees ​

Answers

Answer:

I do

Explanation:

Well, if i didnt, i wouldn't be part of the internet, now would I?

(can i get brainliest? pls?)

totally i agree-even tho i dont really play anymore

PLEASE HELP WITH MY COMPUTER
this thing is popped up and it's annoying. I'm on a HP laptop how do i get rid of it?​

Answers

Answer:

Escape or turn it off then back on??

Explanation:

I'm not very sure what is going on but idfk

Description
How many minutes of video would fill an iPhone with 8 GB of
storage, where 3 GB is already used.
One minute of video takes 150 MB of storage.
One GB (gigabytes) is about 1000 MB (megabytes).
Hint: Do all of your calculations in megabytes (MB).

Answers

33.33 minutes of video

3 GB already used which means you have 5 GB left, 5GB is the same as 5000 MB

So 5000 MB divided by 150 MB is 33.33 minutes of video that can be stored on the iPhone
Other Questions
The House of Representatives are apart of this bench of government Help me plsWhat can happen when humans harvest plant and animal products extensively What was the Proclamation of 1763 and how did it affect thecolonists? Army needs to order a shade for a triangle-shaped window has a base of 6 feet and a height of 4 feet.what is the area of the shade How do the authors of Ads: Why We Buy What We Buy convey their purpose of persuading readers that advertising has changed the daily lives of many people?They explain the beginnings of Post and Kellogg breakfast cereals.They describe the origins of Ivory and Pears soaps.They explain why Coca-Cola used a new version of Santa Claus.They describe the floor mat sale display at Wal-Mart. MOREFREEPOINTSSS HAVE A GOOD DAYY what are some easy words that represent life in the south in the early 1800s. Mr. Matthews gives each of his 32 students 15 minutes topresent a book report to the class. How many minuteswill it take for all of his students to present their reports? there are 60 inches in 5 feet.how many inches are in 8 ft? -5 3/4 - 3 1/2 =?A)2 1/4B)-9 1/4C)-2 1/4D)-8 2/3 100 pts Read the following email:Dear Dr. Jones,Our pharmaceutical company now received 47 complaints about the new pain reliever NoPain, created in your lab. Of the 47 complaints, 24 said their headache got worse, 15 said they had severe cramping after taking the medication, and 8 said they had both problems. We have only been distributing this pain reliever for about 30 days and we are veryconcerned. It has cost our company roughly 1.2 million dollars to create the drug and we have recorded sales of $98,600 in the past month at $10 a bottle, so that is 9,860 bottles. Should we be concerned? Do you think we should pull the product and conduct moreresearch? We may end up losing money on this if we pursue this course of action. Should we keep the product on the shelves and secretly do more research? Or should we just do nothing for the time being, wait it out, and see what happens? Please get back to us as soon as possible with your recommendation. Thank you,Jane SmithHead of Customer RelationsUsing your basic mathematical skills, calculate how long it will take the pharmaceuticalcompany to earn back the amount that it had invested, if it continues to sell the product at thecurrent selling rate. list 10 qualities of an effective leader. PLS HELP I BEG YOUU!!! A shirt costs $98.It is 20% offWhat is the amountI will save ? write 5 sentences with comparative form The Jamestown colony in Virginia was settled to provide raw materials for what country?SpainFranceEnglandPortugal Can anyone answer ASAP Which one of these is not congruent to angle 5? A copy machine makes 84 copies in 3 minutes and 30 seconds, how many copies does it make per minute. Solve the proportion.