All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
computer science
prelude to programming
Questions and Answers of
Prelude to Programming
What is the output of code corresponding to the following pseudocode? Declare A[20] As Integer Declare B[20] As Integer Declare K As Integer For (K = 1; K
What is the output of code corresponding to the following pseudocode if the user inputs 2, 3, 4, 5?= 0 Write Sums [Count] Set Count = Count - 1 End While
What is the output of code corresponding to the following pseudocode? Declare N As Integer Declare K As Integer Declare X[100] As Integer Set N = 4 Set K = 1 While K
Write a program segment that displays the contents of a previously declared array of strings called Names. Assume that the last entry in Names is "ZZZ", which should not be displayed.
Write a program segment that inputs up to 25 whole numbers (integers) from the user, terminated by 0, into an array called Numbers.
If we know that 100 elements have been allocated to the two dimensional array A, then both subscripts of A must run from 0 to 9; that is, A must have 10 rows and 10 columns.True or False
One- and two-dimensional arrays must be declared in the same statement.True or False
The length of a string in a Character array that has been declared as:Declare Chr[10] As Characteris always 10.True or False
A database consists of many tables.True or False
Parallel arrays must be of the same data type.True or False
Parallel arrays must be of the same size.True or False
Array elements are normally stored in a computer’s memory in a sequence of consecutive storage locations.True or False
In two parallel arrays, all corresponding elements must be of the same data type.True or False
The following statement:Declare Array1[10], Array2[20] As Integer allocates storage space for 200 variables.True or False
If a declaration statement allocates 100 storage locations to an array, the program must assign values to all 100 elements.True or False
An array may have some elements that are numbers and other elements that are strings.True or False
One advantage of using subscripted variables (an array) is that they take up fewer storage locations than the same number of unsubscripted variables.True or False
The elements of an array are stored in consecutive storage locations in the computer’s internal memory.True or False
If the arrays Score1, Score2, and Score3 have the same size and the corresponding elements contain related data, they are said to be ____________ arrays.
Revise the Math Test created in the Running With RAPTOR section in this chapter to create a math exam that tests the following:● There should be 20 division questions● The questions should be of
The length of the string called MyName which contains the name "Arnold" is ______________.
Write a program that allows a small business owner to input, in parallel arrays, the type of item, its cost, and the number in stock. The program should output this information in the form of a
The Declare statement allocates ______________ storage locations to the array Name[25].
Each element in an array is identified by its __________.
Create a program that allows the user to input a list of first names into one array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. The
A variable that is used to indicate whether a certain action has taken place is called a(n) ____________.
Input a list of positive numbers, terminated by 0, into an array Numbers[]. Then display the array and the largest and smallest number in it.
What is the output of code corresponding to the following pseudocode if the user’s name is Sammy?Declare Dash As CharacterDeclare Count As IntegerDeclare Number As IntegerDeclare Name As StringSet
Create flowcharts for Exercises 32 and 33 and compare them. Are they the same or different?Data from Exercise 32Data from Exercise 33 Declare Dash As Character Declare A, B, C As Integer Set Dash For
What is the output of code corresponding to the following pseudocode? Declare Dash As Character Declare A As Integer Declare B As Integer Declare C As Integer Set Dash Set A = 1 While A
What is the output of the code corresponding to the following pseudocode? Declare Dash As Character Declare A, B, C As Integer Set Dash For (A = 1; A
Suppose that the first statement in Exercise 30 is changed as follows:Set HelloCount = 2What is the output now?
What is the output of the code corresponding to the following pseudocode? Declare HelloCount As Integer Set HelloCount = 1 Repeat Repeat Write "Hello" Until HelloCount >= 1 Set HelloCount =
Suppose that the variables I and J in Exercise 28 are interchanged (each I is changed to J and vice versa). What is the output now?Data from Exercise 28 Declare I, J As Integer For (I = 1; I
What is the output of the code corresponding to the following pseudocode? Declare I, J As Integer For (I = 1; I
Use a While loop in a program segment that inputs numbers from the user until the number entered is an integer.
What is the output of code corresponding to the following pseudocode, assuming N and X are integer variables? For (N = 4; N
What is the output of code corresponding to the following pseudocode, assuming N and X are integer variables? Set N = 4 %3D Set X = 0 %3D While N < 12 Set X = 12 / N Write X Set X = Floor (X) Write X
Let Num1 = 5.6 and Num2 = 3. Give the value of each of the following expressions:a. Floor(Num1 * Num2)b. Int(Num1 * Num2)
Let Num1 = 2 and Num2 = 3.2. Give the value of each of the following expressions:a. Int(Num2 − Num1)b. Floor(Num1 − Num2)
Redo Exercise 21 using a pre-test loop.Data from Exercise 21Add statements to the following pseudocode that creates a post-test loop which validates the input data:Write "Enter a negative number:
Add statements to the following pseudocode that creates a post-test loop which validates the input data:Write "Enter a negative number: "Input Number
Write a program segment that simulates rolling a die 50 times by generating and displaying 50 random integers in the range 1 to 6.
Write a program segment that simulates flipping a coin 25 times by generating and displaying 25 random integers, each of which is either 1 or 2.
Write an expression that produces random integers in each of the following ranges using the variable Range.a. 1 through 4b. 0 through 3c. 2 through 7
Write an expression that produces random integers in each of the following ranges:a. 1 through 6b. 0 through 1
If Number = 6, give the range of possible integers produced by the following expressions:a. Floor(Random() * Number)b. Floor(Random() * Number) + 3c. Floor(Random() * (Number + 3))
Two nonoverlapping loops may not be nested within a third loop.True or False
A While loop may not be nested within a For loop.True or False
If one For loop is nested within another, then the limit values for the two loops must be different.True or False
If one For loop is nested within another, then the counter variables for the two loops should be different.True or False
If Number = 5, indicate whether each of the following statements is true or false:a. T F Random() * Number = 1, 2, 3, 4, or 5b. T F Floor(Random() * (Number − 2)) = 3, 4, or 5c. T F Floor(Random()
If Number = 7, indicate whether each of the following statements is true or false:a. T F Sqrt(Number) = Int(Sqrt(Number))b. T F Sqrt(Number * Number) = Int(Sqrt(Number * Number))
If Number is an integer variable and MyString = "One potato" then the following statement is valid:Number = Length_Of(MyString)True or False
If Number is an integer variable, then Number = 8 after the following statement is executed:Number = Length_Of("Wow!")True or False
If Number = 16, indicate whether each of the following statements is true or false:a. T F Sqrt(Number) = Floor(Sqrt(Number))b. T F Floor(Sqrt(Number/2)) = Sqrt(Floor(Number/2))
If Number = 3.5, indicate whether each of the following statements is true or false:a. T F Floor(Number * Number) = Number * Numberb. T F Floor(Number/2) = Number/2
The child’s card game, War, consists of two players each having a deck of cards. For each play each person turns over the top card in his or her deck. The higher card wins that round of play and
If Number = 3, indicate whether each of the following statements is true or false:a. T F Int(Number * Number) = Number * Numberb. T F Int(Number/2) = Number/2
Create a program that formats the output of a user’s name using the Length_Of() function. You will need to use the Print statement and the indicator to create this pseudocode. The user should be
Indicate whether each of the following statements is true or false:a. T F You cannot have both a Select Case statement and an If-Then structure within a single loop.b. T F You cannot put a loop
Create a program that will simulate the process of dealing cards from a 52-card deck by generating 1,000 random integers in the range 1–52. Assume that numbers 1–13 represent clubs, 14–26
The starting value of an algorithm used to generate a range of random numbers is called the _________.
For a list of numbers entered by the user and terminated by 0. Write a program to find the sum of the positive numbers and the sum of the negative numbers.
____________ are numbers that belong to a sequence, generated by a mathematical algorithm, in which each number is equally likely to occur.
Create a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.
Fill in the Blank ____________ are numbers that form an unpredictable sequence in which each number is equally likely to occur.
For each of the following Programming Challenges, use the top-down modular approach and pseudocode to design a suitable program to solve it. Whenever appropriate, validate the input data.Alberta
What would be the output if the following pseudocode was run, assuming that the user enters 3 at the prompt?Declare Number As IntegerDeclare Product As IntegerWrite "Enter a number: "Input
Change the pseudocode of Exercise 35 to allow the user to include all floating point numbers (negative numbers as well).Data from in exercise 35Write pseudocode that will average a list of numbers
Draw a flowchart that corresponds to the program segment of Exercise 37.Data from ExerciseWrite pseudocode that will average a list of numbers input by the user. Use the following variables:●
Add data validation to the program segment of Exercise 35 to check that the user enters only positive integer values.Data from Exercise 35Write pseudocode that will average a list of numbers input by
Draw a flowchart corresponding to the pseudocode in Exercise 35.Data from Exercise 35Write pseudocode that will average a list of numbers input by the user. Use the following variables:● Number As
Write pseudocode that will average a list of numbers input by the user. Use the following variables:● Number As Integer● Sum As Integer● Average As Float● Count As IntegerAlso:● Use a While
Add statements to the pseudocode in Exercise 29 that find the average of N numbers, (2 * B − 1), generated within the loop.Data from Exercise 29 Declare A As Integer Declare B As Integer Declare N
Is the loop in Exercise 29 a pre-test loop or a post-test loop?Data from Exercise 29 Declare A As Integer Declare B As Integer Declare N As Integer Set A = 0 %3D For (B = 1; B
Draw a flowchart corresponding to the pseudocode in Exercise 29.Data from Exercise 29 Declare A As Integer Declare B As Integer Declare N As Integer Set A = 0 %3D For (B = 1; B
Rewrite the code in Exercise 29 using a While loop instead of the For loop.Data from Exercise 29 Declare A As Integer Declare B As Integer Declare N As Integer Set A = 0 %3D For (B = 1; B
If N = 4 in the pseudocode in Exercise 29, then what number is displayed when the corresponding code is run?Data from Exercise 29 Declare A As Integer Declare B As Integer Declare N As Integer Set A
Complete each statement regarding the following pseudocode, which sums a set of numbers. a. The accumulator for this program is the variable ____________.b. The counter variable for this program
Given the following loop, fill in the compound condition necessary to ensure that the input is both an integer and positive.
Use a While loop in a program segment that inputs numbers from the user until the number entered is an integer.
What is the output of code corresponding to the following pseudocode?Declare N As IntegerDeclare X As IntegerSet N = 4Set X = 10/NWrite XSet X = Int(X)Write X
Let Num1 = 6.8 and Num2 = 3.1. Give the value of each of the following expressions:a. Floor(Num1 + Num2)b. Ceiling(Num2 + Num1)c. Floor(Num2 − 2)d. Ceiling(Num1 − 2)
Let Num1 = 2 and Num2 = 3.2. Give the value of each of the following expressions:a. Int (Num2 – Num1)b. Int (Num1 – Num2)
Give the value of each of the following expressions:a. Int(5)b. Int(4.7)
Redo Exercise 21 using a pre-test loop.Data from Exercise 21 Add statements to the following pseudocode to create a post-test loop which validates the input data:Declare Number As IntegerWrite
Give the output of the loop in Exercise 19.Data from Exercise 19 Declare K As Integer For (K = 3; K
Consider the following counter-controlled loop:● What is the name of the counter variable?● Give the values of the initial value, the increment, and the limiting value. Declare K As Integer For
Draw a flowchart for the pseudocode in Exercise 15.Data from Exercise 15 Declare Number As Integer Set Number = 2 While Number != 0 Write Number Set Number Number - 1 End While
Draw a flowchart for the pseudocode in Exercise 13.Data from Exercise 13 Declare Number As Integer Set Number = 2 Repeat Write Number Set Number = Number - 1 %3D Until Number = 0 %3D
Give the output of the loop in Exercise 15.Data from Exercise 15a. Is this loop a pre-test loop or a post-test loop?b. List the statements in the body of the loop.c. What is the test condition for
Consider the following loop:a. Is this loop a pre-test loop or a post-test loop?b. List the statements in the body of the loop.c. What is the test condition for this loop? Declare Number As Integer
Give the output of the loop in Exercise 13.Data from Exercise 13a. Is this loop a pre-test loop or a post-test loop?b. List the statements in the body of the loop.c. What is the test condition for
Consider the following loop:a. Is this loop a pre-test loop or a post-test loop?b. List the statements in the body of the loop.c. What is the test condition for this loop? Declare Number As Integer
The following statement is valid: Input Int(X)True or False
A counter-controlled loop cannot be constructed using a Repeat...Until loop.True or False
A counter-controlled loop cannot be constructed using a While statement.True or False
The body of a post-test loop must be executed at least once.True or False
The body of a pre-test loop must be executed at least once.True or False
Showing 200 - 300
of 587
1
2
3
4
5
6