








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
A comprehensive set of questions and answers related to programming foundations, covering topics such as operators, data types, control structures, algorithms, and programming paradigms. It includes practical examples and pseudocode snippets to illustrate key concepts. The material is designed to help students and professionals reinforce their understanding of fundamental programming principles and prepare for exams or certifications. It also covers waterfall and agile approaches, programming libraries, and language characteristics.
Typology: Exams
1 / 14
This page cannot be seen from the preview
Don't miss anything!









Ultimate D278 Scripting and Programming Foundations Which operator should be used to determine if a number is evenly divisible by 5? - % A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20? - Division A variable should hold a person's height in meters. Which data type should the variable be? - Float A variable should hold the names of all past U.S. presidents. Which data type should the variable be? - 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? - 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? - Constant integer minAge Given integer x = 3 and integer y = 5. What is the value of the expression ( x / 2.0) + y? - 6. Given float x = 10.2 and float y = 1.0. What is the value of the expression x / y? - 10. What kind of operator is the == in the expression i == 20? - Equality
What is the purpose of parentheses () in a programming expression? - To group expressions Given float x = 3.0. Which expression evaluates to 2.0? - x / 2 + 0.5 /2 +. Which expression evaluates to true only when the user is within 3 years of 21 years, given a variable x containing a user's age? - ( 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? - Integer A function should convert hours and minutes to seconds, such as converting 1 hour and 10 minutes to 4,200 seconds. What should be the input to the function? - Hours and minutes A function returns a number x cubed. For example, if x is 3, the function returns 3 * 3 * 3, or 27. What should be the input to the function? - x A function calculates the weight difference (Diff) given two sample weights (S1 and S2). What should be the output from the function? - Diff function P(integer x) returns integer y y = 2 * x What does P(5) evaluate to? - 10
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? - 'Hello' will print indefinitely. What is the loop expression in the following pseudocode? i = 0 while i < 20 Put i to output i = i + 1 - i< What is the loop variable initialization in the following pseudocode? y = 0 s = 100. while y < 10 s = s + (s * 5.0) y = y + 1 - y = 0 Order the steps needed to output the minimum of x and y from first (1) to last (4). A Declare variable min B Put min to output C min = x D If y < min, set min = y - ACDB Order the steps needed to calculate speed in miles per hour given a start and end location and time traveled in hours from first (1) to last (4).
A Put speedMph to output B Declare variables distMiles and speedMph C distMiles = endLocation - startLocation D speedMph = distMiles / timeHours - BCDA Order the tasks needed to create a pyramid (large on bottom, small on top) on a table from first (1) to last (4). A Place largest shape. B Clear table C Place smallest shape. D Place middle-sized shape. - BADC 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 == - Put "Goodbye" to output - Outputs Goodbye when user types - 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
Which phase of an agile approach would create a list of components needed to build an online auction site? - Design Which phase of a waterfall approach defines a program's goals? - Analysis After a programmer is done writing a program, another person runs the program hundreds of times, each time with different input, checking that each run yields correct output. Which phase of a waterfall approach is the person carrying out? - Testing A programmer decides a program should convert U.S. units to metric units and decides to write the program in C++ using several functions. Which phase of a waterfall approach is occurring when the programmer starts writing the program? - Implementation A company has a new project it wishes to implement to track and analyze employee and customer interactions. The company leadership determines that the system should support direct data entry as well as automated data capture of phone calls and emails. Which phase of the waterfall process is occurring? - Analysis A programmer shows a program's first version to a customer. The customer provides feedback, which causes the programmer to change the goals of the program. In which phase of an agile approach are goals changed based on customer feedback? - Analysis A programmer shows a program's first version to a customer. Based on feedback, the programmer begins writing a second version of the program. In which phase of an agile approach does the writing of a second version of the program occur? - Implementation
A programmer shows a program's first version to a customer. Based on feedback, the programmer creates a second version, and then has a colleague run the second version on numerous inputs to ensure outputs are correct. Which phase of an agile approach is that colleague carrying out? - Testing A programmer is currently programming the fourth version of a program. Each version has additional features to satisfy more customers. In which phase of an agile approach does the programming of the fourth version occur? - Implementation What does a programmer do first to use an existing programming library?
Variables - To refer to data, like x. Algorithm - A sequence of instructions that solves a problem. Flowchart - A graphical language for creating or viewing computer programs. Run execute - Carrying out a program's statements. String literal - Consists of text (characters) within double quotes, as in "Go #57!". Characters - Any letter (a-z, A-Z), digit (0-9), or symbol (~, !, @, etc.). Newline - A two-character sequence \n whose appearance in an output string literal causes the cursor to move to the next output line. Comment - Text a programmer adds to a program, to be read by humans to better understand the code, but ignored by the program when executing. Whitespace - Refers to blank spaces (space and tab characters) between items within a statement, and to newlines. Moore's Law - Engineers have reduced switch sizes by half about every 2 years. Assignment statement - Assigns a variable with a value, such as x = 5. Variable declaration - Specifies the variable's name and type.
Integer - Can hold whole number values, like 1, 999, 0, or -25 (but not 3. or 0.001). Naming conventions - A set of style guidelines defined by a company, team, teacher, etc., for naming variables. Lower camel case - Capitalizing each word except the first, as in numApples or peopleOnBus. Expression - A combination of items, like variables, literals, operators, and parentheses, that evaluates to a value. Ex: 2 * (x + 1) is an expression. If x is 3, the expression evaluates to the value 8. Incremental development - The process of writing, compiling, and testing a small amount of code, then writing, compiling, and testing a small amount more, and so on. Operator - A symbol that performs a built-in calculation, like + which performs addition. Arguments - Any function input values, appear within ( ), and are separated by commas if more than one. Parameter - A function input specified in a function definition. Loop - A program that repeatedly executes statements while the expression is true; when false, execution proceeds past. Pseudocode - Text that resembles a program in a real programming language but is simplified to aid human understanding.
Waterfall method - Each phase is done in sequence, entirely completing one phase before moving to the next phase. Agile or spiral - A program can be built by doing small amounts of each phase in sequence, and then repeating. Universal Modeling Language (UML) - Is a modeling language for software design that uses different types of diagrams to visualize the structure and behavior of programs. Use case diagram - A behavioral diagram used to visually model how a user interacts with a software program. Class diagram - A structural diagram that can be used to visually model the classes of a program, including data members and functions. Activity diagram - A flowchart used to describe the flow of an activity or set of activities. Sequence diagram - A behavioral diagram that shows interaction between software components and indicates the order of events. Statically typed - Each variable's type must be declared and cannot change while the program runs. Dynamically typed - A variable's type may change while a program executes, based on what is assigned to the variable. Equality operator - Checks whether two values are the same (==) or different(!=). Compiled language - A program written is first converted by a tool into machine code, which can run on a particular machine.
Interpreted Language - A language that is run one statement at a time by another program called an interpreter.