When do you use an else statement?
To Input a variable
To tell what will happen when an if-statement is false.
To end an IF statement.
To handle string values

Answers

Answer 1

Answer:

To tell what will happen when an if-statement is false

Explanation:

We use else statement if if-statement get false.

for example

if(a>20)

{

print "your age is greater than 20"

}

else

{

print "Your age is less than 20"

}

In the pseudo code, you see the use of else statement, that if age is greater than 20 then display message "you are age is greater than 20". if this statement get false, i.e. you are age is not greater than 20 then else statement will be executed and message will be displayed that your age is less than 20.

Why other option are not correct

To input a variable:

to get input, we use input statement of respective programming language not if-else statement.

To end an if statement

we don't use else statement to end if statement. when condition met then if statement will be ended

To handle string value

we use input validation statement to handle if statement.


Related Questions

What is 8 hours, 5 minutes, 22 seconds minus (-) 7 hours, 24 minutes, 37 seconds?

8 hrs 5 mins 22 secs
- 7 hrs 24 mins 37 secs
————————————

Answers

Answer:

Enter time 1 HH:MM:SS8:5:22                                                                                                    

Enter time 2 HH:MM:SS7:24:37                                                                                                  

0:40:45

Explanation:

The program for above in Python is:

from datetime import datetime

s1 = input("Enter time 1 HH:MM:SS")

s2 = input("Enter time 2 HH:MM:SS")

Format1 = '%H:%M:%S'

tdiff = datetime.strptime(s1, Format1) - datetime.strptime(s2, Format1)

print(tdiff)

We are using the datetime class in datetime module for using strptime to find the difference between the two times.

Write a Qbasic program to read the value of base and height of a triangle and find its area. ​

Answers

Answer:

The program to this question as follows:

Program:

PRINT "Program: Area of Triangle" 'print message

INPUT "Enter base: ", base 'defining the variable base and input value from the user

INPUT "Enter height:",height 'defining variable height and input a value from user

Area=base*height/2 'formula to calculate Area

PRINT "Area of Triangle:", Area 'print Area

Output:

Program: Area of Triangle

Enter base:   2

Enter height:  3

Area of Triangle: 3

Explanation:

In the above Qbasic program, first, a print function is used to print the message. In the next line, the input function is defined, which uses the "base and height" variable for user input.

Then another variable "Area" is defined that uses user input values to calculate the area of a triangle, and also store its calculated value.  At the last, the print function is used to print Area variable value  

Write about the hierarchy (highest to lowest) of job opportunities in chosen industry:

Answers

Answer:

Suppose you are working in a Software development company. The hierarchy of job opportunities in a given industry is as mentioned in the explanation section.

Explanation:

Board of Directors

Executives

Program Managers

Project Managers

Programmer analyst.

Quality Testing Officer

Team Leader

Senior Software Engineer.

Software Testing Officer.

Software Engineer.

Software developer.

Junior Developer.

So at the top, we have the board of directors. And then comes the Executive officers. Under them are the Program managers, and they look after multiple projects. The Project Manager, however, handles one project at a time. They are followed by a Programmer analyst, and then comes a Quality testing officer. And then comes the Team leader, and there can be several team leaders under a single project Manager. Remember Programmer analyst and Quality test officer are a separate entity altogether. And same is the case with the technical writer who interacts with each of the team members for collecting data so that he can process the data into meaningful information. The team leader heads Senior Software Engineer. Software Testing Officer,Software Engineer, Software developer and Junior Developer. The technical writer remains in close contact with the team leader all the time, and he ensures that all the writing work like SRS, BRD, FRD, Technical specifications, test report document, user manuals, etc are ready on time. The software Engineer ensures that coding is ready on time, and Senior software engineers ensure that the coding is correct. Software developers work on one technology and the Software Engineer covers all technologies. Software test Engineer tests each module. Junior developers pass through the training, and on completion of their training, they become the Software developer. And each one of these are highly in demand. Though, top officials are required in less numbers and subordinates in more numbers, as they need to do more work guided by expert advice of all the top officials. And this way, the team unitedly completes several software projects each year. And the best team completes in maximum number, and with least bugs.

What is the answer of this question

-Calculate the bit rate required for a UHD TV whose picture resolution is 3840 pixels wide by 2160 tall.

Answers

Answer:

Dubbed DVB-UHDTV comes with two standards, which are known as UHD-1 (4k) and UHD-2 ( 8k). We are concerned with 3840 x 2160 and that is 4k. It has a frame rate of 60 Hz, and the color depth is 30 bit/pix. So the bit rate = no. of pixels in a frame x frame rate x bit depth

= 3840 x 2160 x 60 x 30 bit/ sec

=14929.92 Mbit/sec.

Explanation:

We need to find the number of bits in a frame, which is frame size x bits per pixel x number of pixels, where bits per pixel is bit depth. And for bit rate, we need to multiply this by frame rate, and the number of frames being processed per second, and which is the frequency. The rest is as explained in the answer section.

Other Questions
Mary buys p peaches at the farmer's market for d dollars each. She spends a total of tdollars on peaches. Create an equation that represents the relationship between t and p. what is the length of KM? Gwen recently purchased a new video card, and after she installed it, she realized she did not have the correct connections and was not able to power the video card.What connector(s) should Gwen look for when purchasing a new power supply? (Select all that apply.)a.8-pin PCI-E connectorb.Molex connectorc.24 pin connectord.SATA connectore.P4 MB connectorf.6-pin PCI-E connector Bentham theorized that people rationally choose their behaviors by weighing the pleasure or benefit of their actions against the potential pain or cost. This process is known as: a. hedonistic calculus. b. the avoidance principle. c. the veil of ignorance. d. ethical formalism. Which of the following best explains what caused so many Mormons to migrate westinto what is now Utah during the mid-1800s?A. Mormons had heard that there were large numbers of American Indians in Utah.They went there to convert them.B. The government offered 640 acres of land for free to any settlers who moved toUtah.The Mormons wanted to get the free land.C. Mormons were persecuted because of their religious beliefs. They wanted tomove to where they could practice their religion freely.D. The farmland that the Mormons lived on was exhausted. They wanted to move west to find better farmland. historically speaking state has multiple meanings:nation, country, institutions or society. fact or opinion Find the least-squares regression line: =b0+b1x, through the points (1,0),(0,9), (4,13), (8,20), (10,23). For x=5, what is ? For x=9, what is ? Design a class named Triangle that extends GeometricObject:import java.util.Scanner;abstract class GeometricObject {private String color = "white";private boolean filled;private java.util.Date dateCreated;/** Construct a default geometric object */protected GeometricObject() {}/** Construct a geometric object with color and filled value */protected GeometricObject(String color, boolean filled) {dateCreated = new java.util.Date();this.color = color;this.filled = filled;}/** Return color */public String getColor() {return color;}/** Set a new color */public void setColor(String color) {this.color = color;}/** Return filled. Since filled is boolean ,* the get method is named isFilled */public boolean isFilled() {return filled;}/** Set a new filled */public void setFilled(boolean filled) {this.filled = filled;}/** Get dateCreated */public java.util.Date getDateCreated() {return dateCreated;}@Overridepublic String toString() {return "created on " + dateCreated + "\ncolor: " + color +" and filled: " + filled;}/** Abstract method getArea */public abstract double getArea();/** Abstract method getPerimeter */public abstract double getPerimeter();}The Triangle class contains:Three double data fields named side1, side2, and side3A default constructor that creates a triangle with three sides of length 1.0A constructor that creates a triangle with specified values for side1, side2, and side3Accessor methods for all three data fieldsA method called getArea() that returns the area of a triangleA method named getPerimeter() that returns the perimeter of the triangleA method named toString() that returns the string description of the triangle in the following format: "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3;Test your Triangle class in a Drive program (in the same file) that prompts the user to enter the three sides of the triangle, the color, and whether or not the triangle is filled. The program should create a Triangle object with these sides and set the color and filled properties. Then, it should display the area, perimeter, color, and filled value . stress is a major risk factor in ?a. diseaseb. peer groups c. eatingd. getting dressedplz help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! how do you solve 2.14 x - 12.18=5.76 Certain racial and socioeconomic groups in society are far less likely to have access to computers and the Internet, and this phenomenon is called Select one: a. the computer class effect. b. computer poverty. c. the digital divide. d. None of the choices are correct. Is 8 /15 + 2/5 closer to 0, 1/2, or 1 You have just used the network planning model and found the critical path length is 30 days and the variance of the critical path is 25 days. The probability that the project will be completed in 33 days or less is equal to:_______. A seller uses a perpetual inventory system, and on April 18, a customer discovers that merchandise previously purchased is defective The buyer decides to keep the defective merchandise and the seller allows a $15 price reduction, paid in cash to the buye Complete the journal entry to record the allowance granted to the buyer by selecting the account names from the drop-down menus and entering the dollar amounts in the debit or credit columns Explain the circumstances surrounding World War I and how these set the stage for the Russian Revolution. A rancher owns a rectangular piece of land that is 4.1 mi long and 2.5 mi wide. Find the units for the perimeter of the rectangle defined by this ranch how many people are in the world Millie is using a behavior checklist strategy as well as a prompted praise strategy when working with her second grade behavior disordered student, Kent. She uses both strategies within the same day going back and forth randomly between the two approaches, while recording his on-task behavior. Which of the following designs is Millie employing? Select one: a. Alternating-treatments b. Static group comparison c. Multiple baseline d. Control group time series find the area of the figure. ( sides meet at right angles) PATIENT: Tom Smith DATE OF SERVICE: 9/10/XXBLOOD PRESSURE: 140/90 WEIGHT: 164 PULSE: Rapid TEMPERATURE: 100Tom was seen today at the request of his wife for what she suspects is a recurrence of his cocaine dependence.On physical examination, the following was noted:EARS, EYES, NOSE, AND THROAT: Pupils are dilated.HEART: Heart rate is increased; blood pressure is 140/90.ABDOMEN: Soft, nontender, no abnormal massesPSYCHIATRIC: Oriented to time and place. Patient is very talkative and admits to not eating for the last 36 hours with no sleep for the last 48 hours. The lack of sleep is cocaine induced. Patient admits to using cocaine over the last month and recent days.Referral made for inpatient treatment.ICD-10-CM Code Assignment.......x..........