Docsity

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

Toggle sidebar
bg1
1
SCRIPTING AND PROGRAMMING FOUNDATIONS SOLVED
FOCUSED STUDY GUIDE WITH QUESTIONS AND SOLUTIONS
Question 1. Input.
Answer: A program gets data, perhaps from a file, keyboard,
touchscreen, network, etc.
Question 2. Process.
Answer: A programs performs computations on that data, such as
adding two values like x + y.
Question 3. Output.
Answer: A programs puts that data somewhere, such as to a file,
screen, network, etc.
Question 4. Computational thinking.
Answer: Creating a sequence of instructions to solve a problem.
Question 5. Algorithm.
Answer: A sequence of instructions that solves a problem.
Question 6. Statement.
Answer: Carries out some action and executing one at a time.
Question 7. String literal.
Answer: Consists of text (characters) within double quotes, as in "Go
#57!".
Question 8. Cursor.
Answer: Indicates where the next output item will be placed in the
output.
Question 9. Newline.
Answer: A special two-character sequence \n whose appearance in
an output string literal causes the cursor to move to the next output
line. The newline exists invisibly in the output.
Question 10. Comment.
Answer: Text added to a program, read by humans to understand the
code, but ignored by the program when executed.
Question 11. Whitespace.
Answer: Refers to blank spaces (space and tab characters) between
items within a statement, and to newlines. Whitespace helps
improve readability for humans, but for execution purposes is
mostly ignored.
Question 12. Pseudocode.
Answer: Text that resembles a program in a real programming
language but is simplified to aid human understanding.
pf3
pf4
pf5
pf8

Partial preview of the text

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

SCRIPTING AND PROGRAMMING FOUNDATIONS SOLVED

FOCUSED STUDY GUIDE WITH QUESTIONS AND SOLUTIONS

Question 1. Input.

Answer: A program gets data, perhaps from a file, keyboard, touchscreen, network, etc.

Question 2. Process.

Answer: A programs performs computations on that data, such as adding two values like x + y.

Question 3. Output.

Answer: A programs puts that data somewhere, such as to a file, screen, network, etc.

Question 4. Computational thinking.

Answer: Creating a sequence of instructions to solve a problem.

Question 5. Algorithm.

Answer: A sequence of instructions that solves a problem.

Question 6. Statement.

Answer: Carries out some action and executing one at a time.

Question 7. String literal.

Answer: Consists of text (characters) within double quotes, as in "Go #57!".

Question 8. Cursor.

Answer: Indicates where the next output item will be placed in the output.

Question 9. Newline.

Answer: A special two-character sequence \n whose appearance in an output string literal causes the cursor to move to the next output line. The newline exists invisibly in the output.

Question 10. Comment.

Answer: Text added to a program, read by humans to understand the code, but ignored by the program when executed.

Question 11. Whitespace.

Answer: Refers to blank spaces (space and tab characters) between items within a statement, and to newlines. Whitespace helps improve readability for humans, but for execution purposes is mostly ignored.

Question 12. Pseudocode.

Answer: Text that resembles a program in a real programming language but is simplified to aid human understanding.

Question 13. Assignment statement.

Answer: Assigns a variable with a value, such as x = 5. An assignment statement's left side must be a variable. The right side is an expression.Examples: x = 5, y = a, or z = w + 2.

Question 14. =.

Answer: In programming, = is an assignment of a left-side variable with a right-side value. It does not represent equality like in mathematics.

Question 15. Variable declaration.

Answer: Declares a new variable, specifying the variable's name and type.

Question 16. Identifier.

Answer: A name created by a programmer for an item like a variable or function. An identifier must: be a sequence of letters (a-z, A-Z), underscores (_), and digits (0-9), AND start with a letter or underscore.

Question 17. Reserved word or keyword.

Answer: A word that is part of the language, like integer, Get, or Put. A programmer cannot use a reserved word as an identifier.

Question 18. Lower camel case.

Answer: Abuts multiple words, capitalizing each word except the first, such as numApples.

Question 19. Underscore separated.

Answer: Words are lowercase and separated by an underscore, such as num_apples.

Question 20. Expression.

Answer: A combination of items, like variables, literals, operators, and parentheses, that evaluates to a value. Example: 2 * (x+1)

Question 21. Literal.

Answer: A specific value in code, like 2.

Question 22. Operator.

Answer: A symbol that performs a built-in calculation, like the operator + which performs addition.

Question 23. Unary minus.

Answer: The subtraction sign (-) used as a negative.

Question 24. Note about integer literal.

Answer: Commas are not allowed, so 1,333,555 must be written as 1333555.

Question 25. Incremental development.

Question 40. Nested branches.

Answer: A branch's statements can include any valid statements, including another if-else branch.

Question 41. Equality operator.

Answer: Checks whether two operand's values are the same (==) or different (=!). Note that equality is ==, not just =.

Question 42. Relational operator.

Answer: Checks how one operand's value relates to another, like being greater than.

Question 43. Logical operator.

Answer: Treats operands as being true or false, and evaluates to true or false. Logical operators include and, or, not.

Question 44. Epsilon.

Answer: The difference threshold indicating that floating-point numbers are equal.

Question 45. if-else statement.

Answer: An if expression with the true branch's sub-statements, followed by an else part with any false branch sub-statements.

Question 46. if statement.

Answer: An if expression followed by sub-statements, with no else part.

Question 47. if-elseif statement.

Answer: Starts with an if expression, followed by elseif expressions, and ending with else; when a program reaches the statement, exactly one of those branches will execute. When the else branch has no statements, the else part is omitted.

Question 48. Loop.

Answer: A program construct that repeatedly executes the loop's statements (known as the loop body) while the loop's expression is true; when false, execution proceeds past the loop. Each time through a loop's statements is called an iteration.

Question 49. Infinite loop.

Answer: A loop that never stops iterating. A common error is to accidentally create an infinite loop, often by forgetting to update a variable in the body, or by creating a loop expression whose evaluation to false isn't always reachable.

Question 50. Sentinel value.

Answer: A special value indicating the end of a list, such as a list of positive integers ending with 0, as in 1 0 1 6 3 0.

Question 51. While loop.

Answer: A loop that repeatedly executes the loop body while the loop's expression evaluates to true.

Question 52. For loop.

Answer: A loop consisting of a loop variable initialization, a loop expression, and a loop variable update that typically describes iterating for a specific number of times.

Question 53. Nested loop.

Answer: A loop that appears in the body of another loop. The nested loops are commonly referred to as the inner loop and outer loop.

Question 54. Do-while loop.

Answer: A loop that first executes the loop body's statements, then checks the loop condition. Compared to a while loop, a do-while loop is useful when the loop should iterate at least once.

Question 55. Function definition.

Answer: Consists of the new function's name and a block of statements. The function's name can be any valid identifier.

Question 56. Function call.

Answer: An invocation of a function's name, causing the function's statements to execute.

Question 57. Parameter.

Answer: A function input specified in a function definition. Example: A pizza area function might have diameter as an input.

Question 58. Argument.

Answer: A value provided to a function's parameter during a function call. Example: A pizza area function might be called as PrintPizzaArea(12.0).

Question 59. Modular development.

Answer: The process of dividing a program into separate modules that can be developed and tested separately and then integrated into a single program.

Question 60. Function stub.

Answer: A function definition whose statements have not yet been written.

Question 61. Return statement.

Answer: Returns the specified value and immediately exits the function.

Question 62. Algorithm time efficiency.

Answer: The number of calculations required to solve a problem. For the same problem, some algorithms may be much more time efficient than others.

Question 75. Class diagram.

Answer: A structural diagram that can be used to visually model the classes of a computer program, including member variables and functions. A class is a code blueprint for creating an object that is composed of data members and functions (sometimes called methods) that operate on those data members.

Question 76. Sequence diagram.

Answer: A behavioral diagram that shows interaction between software components and indicates the order of events. These diagrams are commonly used to illustrate the sequence of events needed to handle a particular scenario in software.

Question 77. Compiled language.

Answer: First converted by a tool (compiler) into machine code, which can run on a particular machine. Examples include C, C++, and Java.**

Question 78. Interpreted language (scripting language).

Answer: A language that is run one statement at a time by another program called an interpreter. Examples include Python, Javascript, C#, and MATLAB.

Question 79. Statically typed.

Answer: Each variable's type must be declared and cannot change while the program runs. (Static means unchanging). C, C++, and Java are popular examples.

Question 80. Dynamically typed.

Answer: A variable's type may change while a program executes, usually based on what is assigned to the variable. (Dynamic means changing). Python is a popular example.

Question 81. Object.

Answer: In a program, an object consists of some internal data items plus operations that can be performed on that data.

Question 82. Object-oriented language.

Answer: Supports decomposing a program into objects. C++, Java, Python, and C# provide extensive object-oriented support. In fact, the ++ in C++ suggests C++ is better than C, due in large part to supporting objects. C does not. MATLAB and Javascript provide some support.

Question 83. Markup language.

Answer: Allows a developer to describe a document's content, desired formatting, or other features. A popular markup language is HTML. HTML allows a developer to describe the text, links, images, and other features of a web page. While some people refer to "HTML programming", a markup language is not executed statement-by-

statement like a programming language, and an HTML file is not a program. Rather, a web browser reads an HTML file and renders the corresponding web page. An HTML file surround text by different tags to yield different formatting.

Question 84. Library.

Answer: A set of pre-written functions (and other terms) that carry out common tasks that a programmer can use to improve productivity. After including a library with a program, a programmer can make use of the library's functions. A library's functions typically all relate to the same purpose, like computing statistics, or like displaying graphics. A programmer may include several libraries in a single program.