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

  Write a program that prompts the user for an integer value

write a program that prompts the user for an integer value for a length of a youtube clip in seconds then display the number of hours , minutes and seconds within the given length.

  Create a behavioral state machine for complex classes

Create a behavioral state machine for each of the complex classes in the class diagram. Perform a CRUD analysis to show the interactivity of the objects in the system.

  Benefits associated with technological convergence

Identify additional concerns that you believe might have some social and ethical implications as a result of converging technologies and describe these implications and justify your choices. Include relevant information--facts and/or opinions--fr..

  Three years for applications of information security

Five articles within the past three years for applications of information security, within healthcare organizations.

  What is a uml diagram?

What is a UML diagram? What does it include? Why is it used? What would the UML diagram look like for our lab assignment? This is for computer programming

  Determine probability that contention ends on round k

Determine the probability that a contention ends on round k, and what is a mean number of rounds per contention period?

  Write down differences in company policies of firm

For Firm ABC, each of the relations is in 3NF. Write down two differences should exist in company policies of Firm ABC? Explain your answer.

  From time to time words become obsolete

One more requirement, from time to time words become obsolete. When this happens, such word must be removed from the dictionary. Your program must account for this also.

  Examine amazon using competitive forces-value chain models

Examine Amazon.com using competitive forces and value chain models. How has it replied to pressures from its competitive environment?

  A sporting goods store ships a lot of baseballs

A sporting goods store ships a lot of baseballs. They only have one size shipping-box. Twenty-four baseballs will fill a shipping-box. Produce the pseudocode logic for an algorithm that will compute the number of shipping-boxes required for th..

  Why does segment sequence number remain unchanged

Why does the Segment Sequence Number remain unchanged (indicated by a horizontal line in the graphs) with every drop in the congestion window?

  Create a console application

Create a console application

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