Determine whether or not the two conditions are equivalent

Assignment Help Basic Computer Science
Reference no: EM13776125

1. Determine whether the condition is true or false. Assume a = 2 and b = 3.

((a = b) Or Not (b < a)) And ((a < b) Or (b = a + 1))

2. Determine whether or not the two conditions are equivalent - that is, whether they will be true or false for exactly the same values of the variables appearing in them.

Not ((a = b) Or (a = c)); (a <> b) And (a <> c)

3. Determine the output displayed in the text box when the button is clicked. Assume the response is B

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim letter As String

letter = InputBox("Enter A, B, or C.")

letter = letter.ToUpper

If letter = "A" Then

txtOutput.Text = "A, my name is Alice."

ElseIf letter = "B" Then

txtOutput.Text = "To be, or not to be."

ElseIf letter = "C" Then

txtOutput.Text = "Oh, say, can you see."

Else

txtOutput.Text = "Not a valid letter."

End If

End Sub

4. Identify the errors.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

'Is your program correct?

Dim query, answer1, answer2 As String

query = "Are you sure everything in your program is correct?"

answer1 = InputBox(query)

answer1 = answer1.ToUpper.Substring(0, 1)

If answer1 = "N" Then

txtOutput.Text = "Don't patch bad code, rewrite it."

Else

query = "Does your program run correctly?"

answer2 = InputBox(query)

answer2 = answer2.ToUpper.Substring(0, 1)

If answer2 = "Y" Then

txtOutput.Text = "Congratulations."

Else

txtOutput.Text = "Something you are sure about is wrong."

End If

End Sub

5. The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was declared to be a leap year, with the exception of the years ending in 00 (that is those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. (Test the program on the years 2008, 2009, 1900, and 2000.)

6. For each of the responses shown in the parentheses, determine the output displayed in the text box when the button is clicked.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim yearENIAC As Integer

'Ask question and obtain answer

Dim message As String

message = "In what year was the ENIAC computer completed?"

yearENIAC = CInt(InputBox(message))

'Respond to answer

Select Case yearENIAC

Case 1945

txtOutput.Text = "Correct."

Case 1943 To 1947

txtOutput.Text = "Close, 1945."

Case Is < 1943

txtOutput.Text = "Sorry, 1945. Work on the ENIAC " & _

"began in June 1943."

Case Is > 1947

txtOutput.Text = "No, 1945. By then IBM had built " & _

"a stored-program computer."

End Select

End Sub

(1940, 1945, 1950)

7. Rewrite the code using a Select Case block.

If a = 1 Then

lstOutput.Items.Add("lambs")

End If

If ((a <= 3) And (a < 4)) Then

lstOutput.Items.Add("eat")

End If

If ((a = 5) Or (a > 7)) Then

lstOutput.Items.Add("ivy")

End If

Reference no: EM13776125

Questions Cloud

What role does the statute of frauds play in this contract : Big Time Toymaker (BTT) develops, manufactures, and distributes board games and other toys to the United States, Mexico, and Canada. What role does the statute of frauds play in this contract
Issues related to your selected public health project : Explain the funding issues related to your selected public health project or service related to your Final Project. Include an explanation of whether these issues are long- or short-term, how urgent, and which stakeholders might be most affected .
Ethical issues that can arise : Describe 2 ethical issues that can arise in your selected industry, and discuss why these are ethical issues and not issues relating to morals or values.
Transnational crime and child pornography : Transnational Crime & Child Pornography-Define transnational crime. How has it changed in the last decade
Determine whether or not the two conditions are equivalent : Determine whether or not the two conditions are equivalent - that is, whether they will be true or false for exactly the same values of the variables appearing in them.
Special considerations in testing : Remember to consider Melanie's age and testing with students who might have special needs. Explain what testing accommodations Keith might need to make given Melanie's challenges and why.
What elements of fairy tales are evident in your tale : What are the purposes and effects of fairy tales? What elements of fairy tales are evident in your tale? Does the tale teach a lesson? If so, what? If not, why not?
Think about the concept of culture : Think about the concept of culture. It encompasses much more than ethnic and racial boundaries. Write a 1-2 page essay in which you describe your own cultural identity. How have the many forms of media portrayed you?
Define and explain religious-based terrorism : Define and explain religious-based terrorism, national or ethnic terrorism, race-based or hate terrorism, narco-terrorism, and cyber-terrorism

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd