Docsity

SCRIPTING AND PROGRAMMING FOUNDATIONS MASTER STUDY GUIDE WITH SOLVED QUESTIONS, Exams of Programming Paradigms

Toggle sidebar
bg1
1
SCRIPTING AND PROGRAMMING FOUNDATIONS MASTER
STUDY GUIDE WITH SOLVED QUESTIONS
Question 1. What relationship is common among a programming library's
functions?
Answer: Functions all relate to the same purpose.
Question 2. What is an advantage of using a programming library?
Answer: The code has already been tested.
Question 3. Which language is dynamically typed?
Answer: Python
Question 4. Which language is not built on object-oriented design principles?
Answer: C
Question 5. A language substantially supports a programmer creating items
like person, teacher, and students. Each item has internal data and
some operations. Which characteristic describes that language?
Answer: Object-oriented
Question 6. A programmer wants a compiler to report an error if an integer
variable is assigned with a string. Which kind of language should the
programmer use?
Answer: Statically typed
Question 7. A language uses tags around text to indicate how that text should
be formatted. Which characteristic describes a language having such
tags?
Answer: Markup
Question 8. What is a characteristic of a compiled language?
Answer: Converts to machine language before running
Question 9. What is a characteristic of an interpreted language?
Answer: Runs easily on different kinds of machines
Question 10. What is an advantage of interpreted programs?
Answer: They can be modified at run time.
Question 11. Which characteristic specifically describes a markup language?
Answer: Tags surround text to describe desired formatting.
Question 12. Which characteristic specifically describes interpreted languages?
Answer: They can be run one statement at a time.
Question 13. Which characteristic specifically describes interpreted languages?
Answer: They can run on any machine having the right interpreter.
Question 14. A car drove 200 miles using 10 gallons of fuel. Which operation
should be used to compute the miles per gallon, which is 20?
pf3
pf4
pf5

Partial preview of the text

Download SCRIPTING AND PROGRAMMING FOUNDATIONS MASTER STUDY GUIDE WITH SOLVED QUESTIONS and more Exams Programming Paradigms in PDF only on Docsity!

SCRIPTING AND PROGRAMMING FOUNDATIONS MASTER

STUDY GUIDE WITH SOLVED QUESTIONS

Question 1. What relationship is common among a programming library's functions?

Answer: Functions all relate to the same purpose.

Question 2. What is an advantage of using a programming library?

Answer: The code has already been tested.

Question 3. Which language is dynamically typed?

Answer: Python

Question 4. Which language is not built on object-oriented design principles?

Answer: C

Question 5. A language substantially supports a programmer creating items like person, teacher, and students. Each item has internal data and some operations. Which characteristic describes that language?

Answer: Object-oriented

Question 6. A programmer wants a compiler to report an error if an integer variable is assigned with a string. Which kind of language should the programmer use?

Answer: Statically typed

Question 7. A language uses tags around text to indicate how that text should be formatted. Which characteristic describes a language having such tags?

Answer: Markup

Question 8. What is a characteristic of a compiled language?

Answer: Converts to machine language before running

Question 9. What is a characteristic of an interpreted language?

Answer: Runs easily on different kinds of machines

Question 10. What is an advantage of interpreted programs?

Answer: They can be modified at run time.

Question 11. Which characteristic specifically describes a markup language?

Answer: Tags surround text to describe desired formatting.

Question 12. Which characteristic specifically describes interpreted languages?

Answer: They can be run one statement at a time.

Question 13. Which characteristic specifically describes interpreted languages?

Answer: They can run on any machine having the right interpreter.

Question 14. A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20?

Answer: Division

Question 15. Which operator should be used to determine if a number is evenly divisible by 5?

Answer: %

Question 16. A variable should hold a person's height in meters. Which data type should the variable be?

Answer: Float

Question 17. A variable should hold the names of all past U.S. presidents. Which data type should the variable be?

Answer: String array

Question 18. A program uses the number of seconds in a minute in various calculations. How should the item that holds the number of seconds in a minute be declared?

Answer: Constant integer secondsPerMinute

Question 19. A program determines if a user's age is high enough to run for U.S. president. The minimum age requirement is 35. How should the item that holds the minimum age be declared?

Answer: Constant integer minAge

Question 20. Given integer x = 3 and integer y = 5. What is the value of the expression (x / 2.0) + y?

Answer: 6.

Question 21. Given float x = 10.2 and float y = 1.0. What is the value of the expression x / y?

Answer: 10.

Question 22. What kind of operator is the == in the expression i == 20?

Answer: Equality

Question 23. What is the purpose of parentheses () in a programming expression?

Answer: To group expressions

Question 24. Given float x = 3.0. Which expression evaluates to 2.0?

Answer: x / 2 + 0.5 /2 +.

Question 25. Which expression represents all the values of x, when x is the age ranging from 18 to 24 years old?

Answer: (x >= 18) and (x <= 24)

Question 26. Which data type is used for items that are measured in length?

Answer: Float

Question 27. Which data type should be used to keep track of how many planes are in a hangar?

Question 39. A programmer has developed the following code: count = 0; while count is less than 5: print 'Hello'. What is the result of implementing this code?

Answer: 'Hello' will print indefinitely.

Question 40. What is the loop expression in the following pseudocode? i = 0; while i < 20; Put i to output; i = i + 1

Answer: i < 20

Question 41. What is the loop variable initialization in the following pseudocode? y = 0; s = 100.0; while y < 10; s = s + (s * 5.0); y = y + 1

Answer: y = 0

Question 42. Order the statements needed to output the minimum of x and y from first (1) to last (4).

Answer: Declare variable min; min = x; If y < min, set min = y; Put min to output

Question 43. Given a start and end location and time traveled in hours, order the statements needed to calculate speed in miles per hour from first (1) to last (4).

Answer: Declare variables distMiles and speedMph; distMiles = endLocation - startLocation; speedMph = distMiles / timeHours; Put speedMph to output

Question 44. Order the tasks needed to create a pyramid (large on bottom, small on top) on a table from first (1) to last (4).

Answer: Clear table.; Place largest shape.; Place middle-sized shape.; Place smallest shape.

Question 45. What does the following algorithm determine? if x == y z = 1 else z = 0

Answer: Whether x and y are the same

Question 46. What does the following algorithm accomplish? x = Get next input; if x == -1; Put "Goodbye" to output

Answer: Outputs Goodbye when user types -

Question 47. What does an output of 1 indicate for the following algorithm running on a five-element list of integers? i = 0; x = 0; while i < 5; if list[i] < 0; x = 1; i = i + 1; Put x to output

Answer: At least one integer is negative.

Question 48. When should a programmer develop an algorithm to solve a problem?

Answer: Before writing a program to solve the problem

Question 49. Which text represents an algorithm?

Answer: Insert key, turn key, open door.

Question 50. Which text represents an algorithm?

Answer: Shake bulb; if it rattles, replace it.

Question 51. An algorithm should output "OK" if a list's numbers are all non- zero, else the output is "Not OK." Which test is a valid test of the algorithm?

Answer: Input 99, 0, 5. Ensure output is "Not OK."

Question 52. What is put to output by the following flowchart, if the input is 17?

Answer: OK

Question 53. What is put to output by the following flowchart, if the input is 3 5 -1?

Answer: 6 10

Question 54. What is the purpose of the following class diagram?

Answer: Depicts the Employee class' name, data members, and functions

Question 55. What is the purpose of a use case diagram, such as the following diagram?

Answer: Describes how a user can interact with a program

Question 56. Which elements are characteristic of a class diagram?

Answer: System's classes, attributes, and methods and their features, constraints, and relationships

Question 57. Review the following use case diagram: What does a use case diagram do?

Answer: Provides an overview of several use cases

Question 58. Which phase of a waterfall approach would create a sequence diagram that specifies the required order of events between completed program components?

Answer: Design

Question 59. Which phase of an agile approach would define a hypothesis to find a problem in a program?

Answer: Analysis

Question 60. Which phase of an agile approach would create an executable program?

Answer: Implementation

Question 61. Which phase of an agile approach would create a list of components needed to build an online auction site?

Answer: Design

Question 62. Which phase of a waterfall approach defines a program's goals?

Answer: Analysis

Question 63. After a programmer is done writing a program, another person