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
starting out with programming logic and design
Questions and Answers of
Starting Out With Programming Logic And Design
What type of structure do you use in a program to perform the action that the user has selected from a menu?
When the user selects an item from a menu, the program must use a________ structure to perform an action based on that selection.a. Repetitionb. Sequencec. Menu selectiond. Decision
True or False It is not usually necessary to validate the user’s menu selection.
Design a case structure that can be used with the algorithm you designed for question 1. The case structure should call a module named openDocument if the user selected item 1, should call a module
In most cases, a menu-driven program should be modularized.
What ways for validating a user’s menu selection did we discuss in this chapter?
What type of structure do you use in a program to perform the action that the user has selected from a menu?
If a menu-driven program uses a loop to redisplay the menu after a selected operation has been performed, the menu should probably have an item that the user can select to _______.a. End the
How can you design a menu-driven program so that the menu is redisplayed after the selected operation has been performed?
Explain why most menu-driven programs use a loop to redisplay the menu after the user’s selected action has been performed.
Put the algorithms that you designed for questions 1 and 2 together inside a loop that redisplays the menu after the user’s selected operation is performed, or exits if the user selects item 4 from
A program that uses a multiple-level menu displays________ when it starts.a. A warning to the userb. The main menuc. A submenud. The grand menu
If a menu-driven program does not use a loop to redisplay the menu after each operation, the user will have to rerun the program to select another operation from the menu.
What is the difference between a program that uses a single-level menu and a program that uses a multiple-level menu?
Look for ways to modularize the algorithm that you designed for question 3 and modify it accordingly.
If a program uses a loop to display a menu repeatedly, how does the user end the program?
When the user selects an item from a multiple-level menu,_______ might be displayed next.a. The main menub. A user information formc. A submenud. A question asking the user whether he or she wants to
In a single-level menu, the user might see a submenu appear when an item from the main menu is selected.
When a program has a lot of items for the user to select from, why should you avoid displaying all of the items on one menu?
What is a single-level menu?
When the user selects an operation from a _______, the program immediately performs that operation and then the program redisplays the menu (or the program ends if it does not use a loop to redisplay
What is a multiple-level menu?
When the user selects an operation from a(n) ________, the program might display another menu.a. Multiple-level menub. Single-level menuc. Submenud. Interleaved menu
When a program has a lot of items for the user to select from, why should you avoid displaying all of the items in one menu?
When using subscript notation to specify a character position in a string, what are the subscripts of the first and last characters?
What is wrong with the following pseudocode? // This program assigns a character to the first element in // a string. Declare String letters Set letters [0] = "A" Display "The first letter of the
Design an algorithm that counts the number of digits that appear in the String variable str.
Assume the following declaration appears in a program:What would the following statement display? Declare String name "Joy"
Which pseudocode statement displays the first character in the String variable str?a. Display str[1]b. Display str[0]c. Display str[first]d. Display str
If the following pseudocode were an actual program, what would it display? Declare String str delete (str, 4, 9) Display str "Yada yada yada"
Why doesn’t the following pseudocode perform as indicated in the comments? // This program counts the characters in a string. Declare String word Declare Integer index Declare Integer letters =
Design an algorithm that determines whether the first character in the String variable str is uppercase, and if it is, changes that character to “0”.
If the str variable contains the string "Redmond", which pseudocode statement changes its contents to "Red"?a. delete(str, 3, length(str))b. delete(str, 3, 6)c. Set str = str – "mond"d. Set str[0]
If the following pseudocode were an actual program, what would it display? Declare String str delete (str, 0, 0) delete (str, 3, 3) delete (str, 3, 3) Display str = "Aa Bb CcDd"
True or False The delete library module does not actually remove characters from a string, but replaces them with spaces.
When module A calls module B, which calls module A, it is called recursion.a. Implicitb. Modalc. Directd. Indirect
Suppose myCar is the name of a class variable that references an object, and go is the name of a method. (The go method does not take any arguments.) Write a pseudocode statement that uses the myCar
If the following pseudocode were an actual program, what would it display? Declare String greeting = "Happy" insert (greeting, 0, "Birthday") Display greeting
What is wrong with the following pseudocode? // This program determines whether the user's input is a single // digit. Declare Integer digit // Get the input from the user. Display "Enter a single
True or False When subscripts are used to specify character positions in a string, the first character’s subscript is 0.
Design an algorithm that counts the number of lowercase characters that appear in the String variable str.
Assume the following declaration appears in a program:Write a statement that changes the str variable’s first character to “L”. Declare String str = "Tiger"
Which pseudocode statement displays the last character in the String variable str?a. Display str[–1]b. Display str[length(str)]c. Display str[last]d. Display str[length(str) – 1]
True or False When subscripts are used to specify character positions in a string, the last character’s subscript is the same as the string’s length.
True or False If the String variable str contains the string "Might", then the statement Set str[5] = "y" will change its contents to "Mighty".
Design an algorithm that counts the number of uppercase characters that appear in the String variable str.
Design an algorithm that determines whether the first character in the String variable str is a numeric digit, and if it is, deletes that character.
If the str variable contains the string "berry", which pseudocode statement changes its contents to "blackberry"?a. Set str[0] = "black"b. Set str = str + "black"c. insert(str, 0, "black")d.
If the following pseudocode were an actual program, what would it display? Declare String str = "AaBb CcDd" Declare Integer index For Index = 0 To length (str) 1 If isLower (str[index]) Set
True or False The insert library module automatically expands the size of the string to accommodate the inserted characters.
Design an algorithm that deletes the first and last characters in the String variable str.
Design an algorithm that converts each occurrence of the character “t” in the String variable str to uppercase.
Assume the following declaration appears in a program:Write a statement that inserts the string "Hello " at the beginning of the str variable. After the statement executes, the str variable should
What will the following pseudocode result in?a. An error will occur.b. The variable name will contain the string "Sally".c. The variable name will contain the string "Saly".d. The variable name will
Design an algorithm that replaces each occurrence of the character “x” in the String variable str with a space.Design an algorithm that replaces “Mr.” with “Mister” in the variable.
True or False The is Upper library function converts a character to uppercase, and the is Lower library function converts a character to lowercase.
Assume the following declaration appears in a program:Write a statement that deletes the first three characters in the city variable. Declare String city = "Boston"
True or False An error will occur if you use a subscript on an empty String variable.
In Program 13-2, presented earlier in this chapter, what is the base case of the message module? 123 4 5 6 7 Module main () // By passing the argument 5 to the message module, // we are telling it to
A recursive module ________.a. Calls a different moduleb. Abnormally halts the programc. Calls itselfd. Can be called only once
A module is called once from a program’s main module, and then it calls itself four times. The depth of recursion is ________.a. Oneb. Fourc. Fived. Nine
The following module uses a loop. Rewrite it as a recursive module that performs the same operation. Module trafficSign (int n) While n > 0 Display "No Parking" Set n = n - 1 End While End Module
In this chapter, the rules given for calculating the factorial of a number are as follows:If n = 0 then factorial ( n ) = 1If n > 0 then factorial ( n ) = n × factorial ( n − 1)If you were
When recursion is used to solve a problem, why must the recursive module call itself to solve a smaller version of the original problem?
When a module explicitly calls itself it is called recursion.a. Explicitb. Modalc. Directd. Indirect
How is a problem usually reduced with a recursive module?
Actions taken by the computer when a module is called, such as allocating memory for parameters and local variables, are referred to as _____.a. Overheadb. Setupc. Cleanupd. Synchronization
Look at this partial class definition, and then follow the subsequent instructions:a. Write a constructor for this class. The constructor should accept an argument for each of the fields.b. Write
A(n)______ programming practice is centered on creating objects.a. Object-centricb. Objectivec. Procedurald. Object-oriented
It is a common practice in object-oriented programming to make all of a class’s fields public.
A(n)________ is a member of a class that holds data.a. Methodb. Instancec. Fieldd. Constructor
In many programming languages, what does the New key word do?
The________ specifies how a class’s field or method may be accessed by code outside the class.a. Field declarationb. New key wordc. Access specifierd. Constructor
Look at the following pseudocode class definitions:Given these class definitions, what will the following pseudocode display? Class Plant Public Module message () Display "I'm a plant." End
The superclass inherits fields and methods from the subclass.
A class’s fields are commonly declared with the________ access specifier.a. Privateb. Publicc. ReadOnlyd. Hidden
Polymorphism allows a class variable of the superclass type to reference objects of either the superclass or the subclass types.
What is stale data?
A variable is a special type of variable that can reference an object in the computer’s memory.a. Memoryb. Proceduralc. Classd. Dynamic
What is an access specifier?
In many programming languages, the key word creates an object in memory.a. Createb. Newc. Instantiated. Declare
Look at the following pseudocode, which is the first line of a class definition. What is the name of the superclass? What is the name of the subclass?
What access specifier is commonly used with a class’s fields?
A(n)______ method gets a value from a class’s field but does not change it.a. Retrieverb. Constructorc. Mutatord. Accessor
A(n) method is automatically called when an object is created.a. Accessorb. Constructorc. Setterd. Mutator
What is a constructor? When does a constructor execute?
Suppose a class has a field named description. The field’s data type is String. How would you indicate the field’s data type in a UML diagram?
The_________ characteristic of object-oriented programming allows a superclass variable to reference a subclass object.a. Polymorphismb. Inheritancec. Generalizationd. Specialization
What symbols do you use in a UML diagram to indicate private and public access specification?
What technique was described in this section for finding the classes in a particular problem?
What are classes’ responsibilities?
Look at the following pseudocode; which is the first line of a class definition? What is the name of the superclass? What is the name of the subclass? Class Canary Extends Bird
Look at the following pseudocode class definitions:Given these class definitions, what will the following pseudocode display? Class Vegetable Public Module message () Display "I'm a vegetable." End
What causes an item of data to become stale?
What is a user interface?
True or False Many computer users, especially beginners, find command line interfaces difficult to use.
Design an event handler that will execute when the showNameButton component is clicked.The event handler should perform the following:Store your first name in a label component named
True or False Writing a GUI program today is complex and time consuming because you have to write all of the code that constructs the program’s windows without seeing it on the screen.
What determines how a component appears on the screen?
Design an event handler that will execute when the calcAvailableCreditButton component is clicked. The event handler should perform the following:Declare the following Real variables: maxCredit,
Showing 400 - 500
of 584
1
2
3
4
5
6