What value is stored in uninitialized variables

Assignment Help Data Structure & Algorithms
Reference no: EM132792952

Introduction To Structured Programming

Assignment - Input, Process, Output

1. Give short answers to the following questions:
a. What does a professional programmer usually do first to gain an understanding of a problem?
b. What is pseudocode?
c. Computer programs typically perform what three steps?
d. What does the term user-friendly mean?
e. What two things must you normally specify in a variable declaration?
f. What value is stored in uninitialized variables?

2. Design an algorithm that prompts the user to enter his or her height and stores the user's input in a variable named height.

3. Design an algorithm that prompts the user to enter his or her favourite colour and stores the user's input in a variable named colour.

4. Write assignment statements that perform the following operations with the variables a and b.
a. Adds 2 to a and stores the result in b
b. Multiplies b times 4 and stores the result in a
c. Divides a by 3.14 and stores the result in b
d. Subtracts 8 from b and stores the result in a

5. Assume the variables result, x, y, and z are all integers, and that x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements?
a. Set result = x + y
b. Set result = z * 2
c. Set result = y / x
d. Set result = y - z

6. Write a pseudocode statement that declares the variable cost so it can hold real numbers.

7. Write a pseudocode statement that declares the variable total so it can hold integers.

8. Initialize the variable with the value 0.

9. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total.

10. Write a pseudocode statement that subtracts the variable downPayment from the variabletotal and assigns the result to the variable due.

11. Debug the following code:
a. If the following pseudocode were an actual program, why would it not display the output that the programmer expects?

Declare String favoriteFood
Display "What is the name of your favourite food?" Input favoriteFood
Display "Your favourite food is " Display "favoriteFood"

b. If the programmer translates the following pseudocode to an actual programming language, a syntax error is likely to occur. Can you find the error?

Declare String 1stPrize
Display "Enter the award for first prize." Input 1stPrize
Display "The first prize winner will receive ", 1stPrize

c. The following code will not display the results expected by the programmer. Can you find the error?

Declare Real lowest, highest, average Display "Enter the lowest score." Input lowest
Display "Enter the highest score." Input highest
Set average = low + high / 2
Display "The average is ", average, "."

d. Find the error in the following pseudocode.

Display "Enter the length of the room." Input length
Declare Integer length

Reference no: EM132792952

Questions Cloud

Explain why you made the given particular selections : You will also have to briefly explain why you made those particular selections and explain what you think each work tells people about congruencies.
Social cognitive theories and changing behavior : How do social cognitive theories and changing a behavior reflect on individual characteristics, environmental factors, and reciprocal determinism?
Identify international humanitarian crisis : Identify an international humanitarian crisis that has taken place in the past six months.
How many packets will be required to deliver all web content : You request the Google search homepage, which consists of an HTML webpage and an image (the image that sits above the search box).
What value is stored in uninitialized variables : What does a professional programmer usually do first to gain an understanding of a problem - What two things must you normally specify in a variable declaration
What story tjungurrayi or others is tellin : Australian Aboriginal dreamtime painting at first looks like a non-objective work filled with beautiful patterns. These patterns are really symbols.
Which entries would be made to record a sale : Which of the following entries would be made to record a sale of merchandise on account? A company uses the perpetual inventory method.
Develop a hypothetical architecture with illustrative : Develop a hypothetical architecture with illustrative instruction and data formats, instruction sets, etc., explain the instruction and machine cycles
How you control where information goes : For this discussion board Update the common operational picture (COP). Use the 1st AD ATROPIAN IRON OPORD phase 1 information and the Phase 1 Significant Events

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Create a stock class to manage the stock activity

Create a Stock class to manage the stock activity. It should have private instance variables of company name. Create a get method to calculate and return the profit or loss. This would be calculated as Number of shares * (current price - purchase pri..

  Why can not a binary search be applied on the given list

Why can't a binary search be applied on the list below? In separate chaining, the keys that map to the same hash value are stored in a _____. When designing a hash function, we try to _____ the number of collisions.

  Question about arrays, vector and stl

Suppose if x denotes the mean of a sequence of numbers x1, x2,.....xn, variance is the average of the squares of the deviations of numbers from the mean.

  What is the worst-case running time of algorithm d

Given an n-element array X, Algorithm D calls Algorithm E on each element X[i]. What is the worst-case running time of Algorithm D?

  Open addressing with double hashing where second hash funcn

Given the input {3810, 8832, 8653, 2863, 3580, 8440, 1941, 4290, 8805, 7400}

  What steps should you take when designing an adt

What steps should you take when designing an ADT? The following function computes the sum of the first n ≥ 1 integers. Show how this function satisfies the properties of a recursive function.

  Describe why a brute-force attack does not work

Explain exactly why an exhaustive key search will not succeed even though sufficient computational resources are available. This is a paradox since we know that the OTP is unconditionally secure.

  How to find local minimum of t using only o(log n) to node t

A node v of T is a local minimum if the label x_v is less than the label x_w for all nodes w that are joined to v by an edge.

  Perform data analysis on countries in the region

The team has not set any specific goal for the analysis. Therefore, you have the freedom to explore the data, and dig out anything you feel interesting or significant.

  Data and process modeling

The next phase in the project development cycle is to develop a logical model of the system based on the system requirements. The first step is about the "what" step. We need to show what the system will do, without worrying about how it will do..

  Write an algorithm that given a set x calculate the multiset

Write an algorithm that, given a set X, calculates the multiset ΔX. Consider partial digest L = {1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 9, 9, 10, 11, 12, 15}. Solve the Partial Digest problem for L (i.e., find X such that ΔX = L).

  Data structures and algorithm design

Data Structures and Algorithm Design

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