Kentucky Department of Education



Name_____________________Computational Thinking Midterm Chapters 1-5Stuff from chapter 1Multiple choice are worth one point each1. Computer programs also are known as .a. hardwareb. softwarec. datad. information2. The major computer operations include .a. hardware and softwareb. input, processing, and outputc. sequence and loopingd. spreadsheets, word processing, and data communications3. Visual Basic, C++, and Java are all examples of computer .a. operating systemsb. hardwarec. machine languagesd. programming languages4.. A programming language’s rules are its .a. syntaxb. logicc. formatd. options5. A programmer’s most important task before planning the logic of a program isto .a. decide which programming language to useb. code the problemc. train the users of the programd. understand the problem6. Writing a program in a language such as C++ or Java is known as theprogram.a. translatingb. codingc. interpretingd. compiling7. An English-like programming language such as Java or Visual Basic isa programming language.a. machine-levelb. low-levelc. high-leveld. binary-level8. What does a declaration provide for a variable?a. a nameb. a data typec. both of the aboved. none of the above9. The value stored in an uninitialized variable is .a. garbageb. nullc. compostd. its identifier10. Which of the following is a term used as a synonym for module in someprogramming languages?a. methodb. procedurec. both of thesed. none of these11. Which of the following is a reason to use modularization?a. Modularization avoids abstraction.b. Modularization reduces overhead.c. Modularization allows you to more easily reuse your work.d. Modularization eliminates the need for syntax.12. What is the name for the process of paying attention to important properties whileignoring nonessential details?a. abstractionb. extractionc. extinctiond. modularization13. In most modern programming languages, a variable or constant that is declared ina module is in that module.a. globalb. invisiblec. in scoped. undefined14. What are nonexecuting statements that programmers place within code to explainprogram statements in English?a. commentsb. pseudocodec. triviad. user documentation15. A message that asks a user for input is a(n) .a. commentb. promptc. echod. declaration16. Snarled program logic is called code.a. snakeb. stringc. spaghettid. gnarly17. The three structures of structured programming are .a. sequence, selection, and loopb. selection, loop, and iterationc. sequence, order, and processd. if, else, and then18. Placing a structure within another structure is called the structures.a. stackingb. untanglingc. buildingd. nesting19. When an action is required if a condition is true, but no action is needed if it isfalse, you use a .a. sequenceb. loopc. dual-alternative selectiond. single-alternative selection20. To take action as long as a condition remains true, you use a .a. sequenceb. loopc. dual-alternative selectiond. single-alternative selection21. When you must perform one action when a condition is true and a different onewhen it is false, you use a .a. sequenceb. loopc. dual-alternative selectiond. single-alternative selection22. When you input data in a loop within a program, the input statement that precedesthe loop .a. is the only part of the program allowed to be unstructuredb. cannot result in eofc. is called a priming inputd. executes hundreds or even thousands of times in most business programs23. A group of statements that executes as a unit is a .a. blockb. familyc. chunkd. cohort24. A expression has one of two values: true or false.a. Georgianb. Booleanc. Barbariand. Selective25. In a selection, the else clause executes .a. when the tested condition is trueb. when the tested condition is falsec. alwaysd. only after the if clause executes26. In an AND condition, the most efficient technique is to first ask the questionthat .a. mixes constants and variablesb. uses a less-than or less-than-or-equal-to operatorc. is least likely to be trued. uses a named constant27. If m is true and n is false, then .a. m AND n is trueb. m AND n is falsec. m OR n is falsed. If m is true, then n must be true.28. If conditionA is 30 percent likely to be true and conditionB is 10 percent likely tobe true, then it is most efficient to test conditionA first .a. in an OR decisionb. in an AND decisionc. in any decisiond. never29. If a is true, b is true, and c is false, which of the following expressions is true?a. a OR b AND cb. a AND b AND cc. a AND b OR cd. two of the above30. The statements executed within a loop are known collectively as the .a. loop bodyb. loop controlsc. sequencesd. sentinels31. A counter keeps track of .a. the number of times an event has occurredb. the number of machine cycles required by a segment of a programc. the number of loop structures within a programd. the number of times software has been revised32. Adding 1 to a variable is also called it.a. digestingb. resettingc. decrementingd. incrementing33. When you decrement a variable, you .a. set it to 0b. reduce it by one-tenthc. subtract a value from itd. remove it from a program34. When two loops are nested, the loop that is contained by the other isthe loop.a. captiveb. unstructuredc. innerd. outer35. Typically, the value added to an accumulator variable is .a. 0b. 1c. the same for each iterationd. different in each iterationMatch the definition with the appropriate term. (Worth 1 point each)puter system devicesb. syntax2. Another word for programsa. compiler3. Language rulesc. logic4. Order of instructionsd. hardware5. Language translatore. softwareWorth 1 point eachExplain why each of the following names does or does not seem like a good variablename to you. (Worth 1 point each)ddsctamtdiscountAmountdiscount AmountdiscountAssume that profit = 4 and sales = 7. What is the value of each of thefollowing expressions? (Worth 1 point each)profit + sales * 2profit + 4 – sales / 2(profit + sales) * 2profit – 3 * 2 + sales4 * ((profit – sales) + 2) + 10Each of the flowchart segments in Figure 3-24 is unstructured. Redraw eachsegment so that it does the same thing but is structured. (Worth 5 point each)Assume that the following variables contain the values shown:numberBig = 300 numberMedium = 100 numberSmall = 5wordBig = "Elephant" wordMedium = "Horse" wordSmall = "bug”For each of the following Boolean expressions, decide whether the statement istrue, false, or illegal. (Worth 1 point each)a. numberBig = numberSmallb. numberBig > numberSmallc. numberMedium < numberSmalld. numberBig = wordBige. numberBig = "Big"f. wordMedium = "Medium"g. wordBig = "Elephant"h. numberMedium <= numberBig / 3i. numberBig >= 200j. numberBig >= numberMedium + numberSmallThe Dash Cell Phone Company charges customers a basic rate of $5 per month tosend text messages. Additional rates are as follows: (Worth 20 points)The first 50 messages per month, regardless of message length, are included inthe basic bill.An additional five cents is charged for each text message after the 50th message,up to 100 messages.An additional 10 cents is charged for each text message after the 100th message.Federal, state, and local taxes add a total of 12 percent to each bill.Design a flowchart or pseudocode for the following:a. A programthat accepts the following data about one customer’smessages: area code(three digits), phone number (seven digits), and number of textmessages sent.Displayall the data, including the month-end bill both before and after taxes are added. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download