Docsity

D278 SCRIPTING AND PROGRAMMING FOUNDATIONS KEY CONCEPTS AND STUDY NOTES, Exams of Programming Paradigms

Toggle sidebar
bg1
D278 SCRIPTING AND
PROGRAMMING FOUNDATIONS
KEY CONCEPTS AND STUDY NOTES
โ—‰ What relationship is common among a programming library's
functions?
Answer: Functions all relate to the same purpose.
โ—‰ What is an advantage of using a programming library?
Answer: The code has already been tested.
โ—‰ Which language is dynamically typed?
Answer: Python
โ—‰ Which language is not built on object-oriented design principles?
Answer: C
โ—‰ A language substantially supports a programmer creating items
like person, teacher, and students. Each item has internal data and
some operations.
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download D278 SCRIPTING AND PROGRAMMING FOUNDATIONS KEY CONCEPTS AND STUDY NOTES and more Exams Programming Paradigms in PDF only on Docsity!

D278 SCRIPTING AND

PROGRAMMING FOUNDATIONS

KEY CONCEPTS AND STUDY NOTES

โ—‰ What relationship is common among a programming library's functions? Answer: Functions all relate to the same purpose. โ—‰ What is an advantage of using a programming library? Answer: The code has already been tested. โ—‰ Which language is dynamically typed? Answer: Python โ—‰ Which language is not built on object-oriented design principles? Answer: C โ—‰ 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 โ—‰ 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 โ—‰ A language uses tags around text to indicate how that text should be formatted. Which characteristic describes a language having such tags? Answer: Markup โ—‰ What is a characteristic of a compiled language? Answer: Converts to machine language before running โ—‰ What is a characteristic of an interpreted language? Answer: Runs easily on different kinds of machines

โ—‰ A variable should hold the names of all past U.S. presidents. Which data type should the variable be? Answer: String array โ—‰ 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 โ—‰ 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 โ—‰ Given integer x = 3 and integer y = 5. What is the value of the expression (x / 2.0) + y? Answer: 6.

โ—‰ Given float x = 10.2 and float y = 1.0. What is the value of the expression x / y? Answer: 10. โ—‰ What kind of operator is the == in the expression i == 20? Answer: Equality โ—‰ What is the purpose of parentheses () in a programming expression? Answer: To group expressions โ—‰ Given float x = 3.0. Which expression evaluates to 2.0? Answer: x / 2 + 0.5 /2 +. โ—‰ 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)

Answer: Diff โ—‰ function P(integer x) returns integer yy = 2 * x What does P(5) evaluate to? Answer: 10 โ—‰ Function F()Put "Hey" to outputWhat entire output appears after three successive calls to F()? Answer: HeyHeyHey โ—‰ What is a valid user-defined function name? Answer: Any valid identifier โ—‰ A function MyFct has an input x and an output z. What does MyFct return? Answer: z only โ—‰ What is the return value of a function? Answer: Output of a function

โ—‰ A program should continue accepting input numbers, adding each to a sum, until a 0 is input. Which control structure should be used? Answer: While loop โ—‰ Joe is building an online game. He wants to provide a riddle and have the player guess the answer. The game needs to prompt the user to enter the answer, check to see if it the input provided does not match the correct answer, and continue prompting the user until the answer entered matches the correct answer. Which control structure supports Joe's needs? Answer: Do-while loop โ—‰ What is put to output by the following pseudocode? x = 3 do Put x to output Put " " to output x = x - 1 while x > 0 Answer: 3 2 1