












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
What does a programmer do first to use an existing programming library? Include the library. What relationship is common among a programming library's functions? Functions all relate to the same purpose. What is an advantage of using a programming library? The code
Typology: Exams
1 / 20
This page cannot be seen from the preview
Don't miss anything!













What does a programmer do first to use an existing programming library? Include the library. What relationship is common among a programming library's functions? Functions all relate to the same purpose. What is an advantage of using a programming library? The code has already been tested. Which language is dynamically typed? Python. Which language is not built on object-oriented design principles? C. Which characteristic describes a language that supports creating items with internal data and operations? Object-oriented. Which kind of language should a programmer use to report an error if an integer variable is assigned a string? Statically typed. Which characteristic describes a markup language? Tags surround text to indicate formatting. What is a characteristic of a compiled language? Converts to machine language before running. What is a characteristic of an interpreted language? Runs easily on different kinds of machines. What is an advantage of interpreted programs? They can be modified at run time.
Which characteristic specifically describes interpreted languages? They can run one statement at a time. Which operation should be used to compute miles per gallon from 200 miles and 10 gallons? Division. Which operator determines if a number is evenly divisible by 5? The modulus operator (%). Which data type should hold a person's height in meters? Float. Which data type should hold the names of all past U.S. presidents? String array. How should the item that holds the number of seconds in a minute be declared? Constant integer secondsPerMinute. How should the item that holds the minimum age to run for U.S. president be declared? Constant integer minAge. What is the value of the expression (x / 2.0) + y when x = 3 and y = 5? 6.0. What is the value of the expression x / y when x = 10.2 and y = 1.0? 10.2. What kind of operator is == in the expression i == 20? Equality. What is the purpose of parentheses () in a programming expression? To group expressions. Which expression evaluates to 2.0 when x = 3.0? x / 3 * 2 + 2. Which expression represents all the values of x when x is the age ranging from 18 to 24 years old? (x >= 18) and (x <= 24). Which data type is used for items that are measured in length? Float. Which data type should be used to keep track of how many planes are in a hangar?
i < 20 What is the loop variable initialization in the following pseudocode: y = 0; while y < 10 { y = y + 1; }? y = 0 What is the correct order to output the minimum of x and y? Declare variable min; min = x; If y < min, set min = y; Put min to output. What does the following algorithm determine: if x == y { z = 1 } else { z = 0 }? Whether x and y are the same. What does the following algorithm accomplish: x = Get next input; if x == - 1 { Put 'Goodbye' to output }? Outputs Goodbye when user types - 1. What does an output of 1 indicate for the following algorithm running on a five-element list of integers? At least one integer is negative. When should a programmer develop an algorithm to solve a problem? Before writing a program to solve the problem. Which text represents an algorithm? Insert key, turn key, open door. What is a valid test of the algorithm: An algorithm should output 'OK' if a list's numbers are all non- zero? Input - 3, - 2, 5. Ensure output is 'Not OK.' What is put to output by the following flowchart if the input is 17? Too young. What is the purpose of the following class diagram? Depicts the Employee class' name, data members, and functions. What is the purpose of a use case diagram? Describes how a user can interact with a program. Which elements are characteristic of a class diagram? System's classes, attributes, and methods and their features, constraints, and relationships. What does a use case diagram do? Provides an overview of several use cases.
Which phase of a waterfall approach would create a sequence diagram? Design. Which phase of an agile approach would define a hypothesis to find a problem in a program? Analysis. Which phase of an agile approach would create an executable program? Implementation. Which phase of a waterfall approach defines a program's goals? Analysis. Which phase of a waterfall approach is the person carrying out when testing a program? Testing. Which phase of a waterfall approach is occurring when the programmer starts writing the program? Implementation. Which phase of the waterfall process is occurring when determining system requirements? Analysis. What is the analysis phase in agile methodology? The phase where goals are changed based on customer feedback. What is the design phase in agile methodology? The phase where the programmer begins writing a second version of the program based on customer feedback. What is the implementation phase in agile methodology? The phase where the programmer is currently programming a new version of the program with additional features. What is the testing phase in agile methodology? The phase where a colleague runs the second version of the program on numerous inputs to ensure outputs are correct. What is pseudocode? Text that resembles a program in a real programming language but is simplified to aid human understanding. What is a variable? A named item, such as x or numPeople, used to hold a value.
What is the output of 'Put "a\nb\nc" to output'? a b c. What is the output of 'numCars = Get next input'? The variable numCars is assigned the next input value. Is 'num_Cars1' a valid identifier? Yes. Is '3rdPlace' a valid identifier? No. What is a reserved word in programming? A word that is part of the programming language and cannot be used as an identifier. What is the output of 'x = y + z' if y is 3 and z is 5? x is assigned the value 8. Is 'Get' a valid identifier? No. What is a symbolic placeholder? A symbolic placeholder is a variable or identifier that represents a value or object in programming. How do you save a value to a variable? You save a value to a variable by declaring the variable and using an assignment statement. What is a programming expression? A programming expression is any piece of code that the computer evaluates to produce a single value. What is an identifier? An identifier is a technical name you create to identify a variable, function, or other items in your code. What constitutes a valid identifier? A valid identifier must start with a letter or underscore, and may contain letters, digits, or underscores after the first character. What is a literal? A literal is a specific value written directly into the code. What is an operator?
An operator is a symbol that performs an action on one or more values (operands) and produces a result. What precedence rules does programming use? Programming uses precedence rules where parentheses are evaluated first, followed by multiplication/division, and then addition/subtraction. How does an integer differ from a float? Integers store whole numbers, while floats store decimal numbers. What happens if you divide two integers? Dividing two integers results in an integer; dividing an integer by a float results in a float. What happens if you divide a nonzero floating-point number by zero? Dividing a nonzero floating-point number by zero returns infinity. How do you convert an item's type? You convert an item's type using a type-casting function. What does the modulo operator do? The modulo operator returns the remainder of a division operation. What is the difference between a variable and a constant? Variables can change their value, while constants cannot change. How does an array work? An array stores multiple values in indexed positions. What does an index reference? An index references the position of an element within an array. What is the purpose of different data types? Different data types are used to store data in appropriate formats. What is the difference between compiled and interpreted languages? Compiled languages are translated before execution, while interpreted languages are translated during execution. Which languages are compiled? Languages such as C, C++, and Rust are compiled. Which languages are interpreted? Languages such as Python and Ruby are interpreted.
What are the three logical operators? The three logical operators are AND, OR, and NOT. Explain precedence rules. Precedence rules dictate that multiplication and division are evaluated before addition and subtraction. How is an infinite loop created? An infinite loop is created using a loop with no terminating condition. What is a sentinel value? A sentinel value is a special value that signals stopping a loop. What are the three parts of a loop? The three parts of a loop are initialization, condition, and update. What is the difference between while and do/while? A do/while loop runs at least once, while a while loop may not run at all. Which control structure is guaranteed to run once? The do/while control structure is guaranteed to run at least once. Which loop is used when unsure how many iterations? The while loop is used when the number of iterations is uncertain. Which loop is used when you know the number of iterations? The for loop is used when the number of iterations is known. What is a function? A function is a reusable block of code that performs a specific task. Why are functions useful? Functions are useful because they reduce repetition in code. What is a function call? A function call is the execution of a function. What are parameters and arguments? Parameters are inputs defined in a function, while arguments are the values passed to those parameters. What happens if you define a function but don't call it? If you define a function but don't call it, it is ignored.
What does a return statement do? A return statement sends a value back from a function. What is a binary search? A binary search searches by halving a sorted list. What is a linear search? A linear search searches sequentially through a list. What is SDLC? SDLC stands for Software Development Life Cycle. What are the four phases of SDLC? The four phases of SDLC are analysis, design, implementation, and testing. In which phase do you write code? Implementation phase. Waterfall vs agile? Waterfall is sequential; agile is iterative. What is UML? Unified Modeling Language, a modeling language used to specify, visualize, develop, and document software system artifacts. Which UML diagrams are structural? Class diagram. Which UML diagrams are behavioral? Sequence, state, use case diagrams. Which UML diagrams are activity diagrams? Activity diagram. UML diagrams used in analysis phase? Use case diagrams, class diagrams, sequence diagrams. UML diagrams used in design phase? Class and sequence diagrams. UML diagrams used in implementation phase? Deployment diagrams, class diagrams.
If you need to store a price like $19.99, which data type should you use in Coral? float. What is the value of result after: result = 10 / (2 + 3) * 2?
In Coral, what is a 'literal'? A fixed value written directly in the code. Which of the following is an example of 'camelCase'? totalScoreValue. What is camelCase? A style of writing where the first letter of each word is capitalized except for the first word, e.g., totalScoreValue. What is the value of val after val = 5, val = val + 1, val = val * 2? The value of val is 12. What shape represents a decision point in a Coral flowchart? A diamond. If x = 10, what is the result of x = x % 3? The result is 1. Which of these is used to store a single whole number like 42? An integer. In the statement Put x to output, what is x? An identifier. What is the output of the following sequence if the user inputs 5? x = Get next input, Put x * 2 to output. The output is 10. How are variable declarations usually separated from the rest of the code for readability? With a blank line. True or False: In Coral, myVar and myvar are considered the same identifier. False. What is the result of 5 / 2 in Coral if both are integers?
The result is 2. Which of these is a string literal? A string literal is "Score: ". In the statement num = num + 1, what is the value of num on the left called? The variable being assigned. What is the value of x after: x = 10, y = 5, x = y + y? The value of x is 10. Which Coral keyword is used to declare a variable that holds decimal numbers? float. If x = 2 and y = 10, what is z after z = y / x / 2? The value of z is 2.5. What is the result of 2 * (5 + 1)? The result is 12. True or False: A variable must be declared before it is used in an assignment. True. Which of these is NOT allowed in an identifier name? A hyphen (-). What is the value of x after: x = 5, x = x - 2, x = x + 10? The value of x is 13. What is the output of Put "Hello\nWorld" to output? The output is Hello and World on two separate lines. What happens if a program divides an integer by zero? The program terminates with an error. In the code integer age = 20, what is the identifier? The identifier is age. What is the result of 10 + 20 / 10? The result is 12. Which of these is a valid integer literal? A valid integer literal is - 15.
Waterfall. What is the final value of x after this code segment executes? x = 5 y = 2 x = x * y + 3 The final value is 13. Which search algorithm is generally the most efficient for finding a value in a sorted list of 1, elements? Binary search. A loop that never reaches a condition to stop is known as a(n): Infinite loop. What is the output of the following Coral code? x = 15 if x > 10 Put "Large" to output else Put "Small" to output. The output is Large. What type of UML diagram is used to show the static structure of a system? Class diagram. Which statement correctly describes a variable? A named storage location in memory for data that can change. What is the correct way to write 'x is not equal to 5' as a Boolean expression in Coral? x != 5. In algorithmic complexity, what does the 'Big-O' notation represent? The worst-case scenario for runtime or space required. Which data type would be most appropriate for storing a user's bank account balance? float. What is the primary benefit of the 'Agile' software development approach compared to 'Waterfall'? It is more responsive to changing requirements during development. What is the value of the integer variable count after the following loop finishes? count = 0 while count < 3 count = count + 1 The value is 3. In programming, what is a 'literal'? A fixed value written directly in the code, like 5 or "Hello". What happens if a programmer assigns a float value to an integer variable? The value becomes 3 (truncation).
Which logic operator evaluates to true only if BOTH operands are true? and. What is the main purpose of using comments in a script? To provide explanations for humans to read. Evaluate the result of the following logical operation given x = 10, y = 20: (x > 5) or (y < 15) The result is true. What is the process of finding and fixing errors in a program called? Debugging. A variable that has only two possible values, true or false, is of which data type? Boolean. Which of the following describes a 'nested loop'? A loop located entirely within the body of another loop. Which part of a function definition specifies the inputs the function receives from the caller? Parameters. What is the time complexity of searching for an item in an unsorted list of N items using linear search? O(N). What is the value of result after evaluating: 10 + 5 * 2 - 4? The value is 16. Sentinel value a special value indicating the end of a list, such as a list of positive integers ending with 0, as in 10 1 6 3
What precedence rules does programming use? How does an integer differ from a float? What happens if you divide two integers? What happens if you divide an integer and a float? How do you convert an item's type? What does the modulo operator do? What is the difference between a variable and a constant? How does an array work?