Midterm COP 2000.pdf - Question 1 2 out of 2 points A set...

This preview shows page 1 out of 41 pages.

You've reached the end of this preview.

Unformatted text preview: Question 1 2 out of 2 points A set of well-defined steps for performing a task or solving a problem is known as a(n): Selected Answer: Answers: B. algorithm A. central processing unit B. algorithm C. None of these D. encoded instruction E. hierarchy Question 2 0 out of 2 points Characters or symbols that perform operations on one or more operands are: Selected Answer: D. syntax Answers: A. None of these B. program operands are: Selected Answer: D. syntax Answers: A. None of these B. program ops C. op codes D. syntax E. operators Question 3 2 out of 2 points What does the term hardware refer to? Selected Answer: C. the physical components that a computer is made of Answers: A. the way a computer's storage space is organized B. the relative difficulty of programming C. the physical components that a computer is made of D. the logical flow of instructions E. None of these Question 4 2 out of 2 points The programmer usually enters source code into a computer using: Selected Answer: A. a text editor Answers: A. a text editor B. None of these C. pseudocode D. a hierarchy chart E. a compiler Question 5 0 out of 2 points The ________ decodes an instruction and generates electrical signals. Selected Answer: Answers: C. BIOS A. None of these B. control unit The ________ decodes an instruction and generates electrical signals. Selected Answer: Answers: C. BIOS A. None of these B. control unit C. BIOS D. arithmetic and logic unit E. main memory Question 6 0 out of 2 points Programmer-defined names of memory locations that may hold data are: Selected Answer: C. operands Answers: A. None of these. B. variables C. operands D. operators E. syntax Question 7 0 out of 2 points Unix and Windows 2000 are examples of ________ operating systems. Selected Answer: C. commanddriven Answers: A. single tasking B. None of these C. commanddriven D. multitasking E. Macintosh Question 8 0 out of 2 points The programming process consists of several steps, which include: Selected Answer: Answers: D. input, processing, and output A. key words, operators, and punctuation B. design, creation, testing, and debugging C. syntax, logic, and error handling The programming process consists of several steps, which include: Selected Answer: Answers: D. input, processing, and output A. key words, operators, and punctuation B. design, creation, testing, and debugging C. syntax, logic, and error handling D. input, processing, and output E. None of these Question 9 2 out of 2 points This is a volatile type of memory, used for temporary storage. Selected Answer: Answers: C. RAM A. a hard disk B. None of these C. RAM D. a floppy disk E. ALU Question 10 2 out of 2 points During which stage does the central processing unit retrieve from main memory the next instruction in the sequence of program instructions? Selected Answer: C. fetch Answers: A. execute B. portability stage C. fetch D. decode Question 11 2 out of 2 points What will the following code display? cout << "Monday"; cout << "Tuesday"; cout << "Wednesday"; Selected Answer: C. MondayTuesdayWednesda y Answers: A. "Monday" "Tuesday" Selected Answer: C. MondayTuesdayWednesda y Answers: A. "Monday" "Tuesday" "Wednesday" B. Monday Tuesday Wednesday C. MondayTuesdayWednesda y D. Monday Tuesday Wednesday Question 12 0 out of 2 points In programming terms, a group of characters inside a set of quotation marks is called a: Selected Answer: A. statement Answers: A. statement B. operation C. None of these D. string literal E. variable marks is called a: Selected Answer: A. statement Answers: A. statement B. operation C. None of these D. string literal E. variable Question 13 0 out of 2 points What is the modulus operator? Selected Answer: B . || Answers: A . + B . || C . What is the modulus operator? Selected Answer: B . || Answers: A . + B . || C . % D . * E . & Question 14 2 out of 2 points Besides decimal, two other number systems you might encounter in C++ programs are: Selected Answer: A. hexadecimal and octal Besides decimal, two other number systems you might encounter in C++ programs are: Selected Answer: A. hexadecimal and octal Answers: A. hexadecimal and octal B. unary and quaternary C. octal and fractal D. base 7 and base 9 E. None of these Question 15 0 out of 2 points This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires. Selected Answer: Answers: D. int A. bytes B. f(x) C. sizeof D. int E. len on your computer system an integer data value requires. Selected Answer: Answers: D. int A. bytes B. f(x) C. sizeof D. int E. len Question 16 0 out of 2 points If you use a C++ key word as an identifier, your program will: Selected Answer: E. compile, link, but not execute Answers: A. execute with unpredictable results B. not compile C. understand the difference and run without problems D. None of these E. compile, link, but not execute Question 17 2 out of 2 points How would you consolidate the following declaration statements into one statement? int x = 7; int y = 16; int z = 28; Selected Answer: E. int x = 7, y = 16, z = 28; Answers: A. int x, y, z = 7, 16, 28 B. None of these will work. C. int x = 7 y = 16 z = 28; D. int x = 7; y = 16; z = 28; E. int x = 7, y = 16, z = 28; Question 18 2 out of 2 points The float data type is considered ________ precision, and the double data type is considered ________ precision. Selected Answer: C. single, double The float data type is considered ________ precision, and the double data type is considered ________ precision. Selected Answer: C. single, double Answers: A. integer, double B. float, double C. single, double D. short, long E. None of these Question 19 2 out of 2 points These are used to declare variables that can hold real numbers. Selected Answer: D. floating point data types Answers: A. real data types B. None of these C. long data types D. floating point data types E. integer data types These are used to declare variables that can hold real numbers. Selected Answer: D. floating point data types Answers: A. real data types B. None of these C. long data types D. floating point data types E. integer data types Question 20 0 out of 2 points A variable whose value can be either true or false is of this data type. Selected Answer: C. binary Answers: A. float B. None of these C. binary D. T/F E. bool Question 21 2 out of 2 points When this operator is used with string operands it concatenates them, or joins them together. Selected Answer: Answers: C. + A. * B. % C. + D. & E. None of these Question 22 2 out of 2 points In the following C++ statement, what will be executed first according to the order of precedence? Selected Answer: Answers: E. 3 *2 A. 10 / 2 B. 7 - 10 Selected Answer: Answers: E. 3 *2 A. 10 / 2 B. 7 - 10 C. 2 +7 D. 6 -3 E. 3 *2 Question 23 2 out of 2 points Associativity is either right to left or: Selected Answer: C. left to right Answers: A. top to bottom B. None of these C. left to right D. undetermin able Associativity is either right to left or: Selected Answer: C. left to right Answers: A. top to bottom B. None of these C. left to right D. undetermin able E. front to back Question 24 0 out of 2 points This manipulator causes the field to be left-justified with padding spaces printed to the right. Selected Answer: C. None of these Answers: A. left_justify B. left C. None of these D. right E. left_pad Question 25 2 out of 2 points When using the sqrt function you must include this header file. Selected Answer: D. cmat h Answers: A. cstdli b B. ioma nip C. cstrin g D. cmat h E. iostre am Question 26 2 out of 2 points The function, pow(x, 5.0), requires this header file. Selected Answer: B. cmat h Answers: A. ioma nip B. cmat h C. cstrin g D. iostre am E. cstdli b Question 27 0 out of 2 points The statement will read up to this many characters into str. Selected D. ten The statement will read up to this many characters into str. Selected Answer: D. ten Answers: A. nine B. eleven C. eight D. ten E. None of these Question 28 0 out of 2 points Which is true about the following statement? Selected Answer: Answers : C. It outputs "setw(4)" before the value in the variable num4. A. It should use setw(10) to output the value in the variable num10. B. It allows four spaces for the value in the variable num4. C. It outputs "setw(4)" before the value in the Selected Answer: Answers : C. It outputs "setw(4)" before the value in the variable num4. A. It should use setw(10) to output the value in the variable num10. B. It allows four spaces for the value in the variable num4. C. It outputs "setw(4)" before the value in the variable num4. D. It inputs up to four characters stored in the variable num4. E. None of these Question 29 2 out of 2 points When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression. Selected Answer: E. parenthese s Answers: A. coercions B. None of these C. calculations D. exponents E. parenthese insert ________ that do not appear in the algebraic expression. Selected Answer: E. parenthese s Answers: A. coercions B. None of these C. calculations D. exponents E. parenthese s Question 30 0 out of 2 points Which line in the following program will cause a compiler error? Selected Answer: A Selected Answer: A . 6 Answers: A . 6 B . 7 C . 8 D . 9 Question 31 2 out of 2 points What is the output of the following segment of code if 4 is input by the user when asked to enter a number? What is the output of the following segment of code if 4 is input by the user when asked to enter a number? Selected Answer: A. 13 Answers: A. 13 B. None of these C. 0 D. 3 E. 28 Question 32 2 out of 2 points This operator takes an operand and reverses its truth or falsehood. Selected Answer: D. ! Answers: A. relational B. None of these C. || D. ! E. arithmetic Question 33 0 out of 2 points This operator is used in C++ to represent equality. Selected Answer: Answers: D. = A. !! B. >< C. == D. = E. None of these This operator is used in C++ to represent equality. Selected Answer: Answers: D. = A. !! B. >< C. == D. = E. None of these Question 34 2 out of 2 points If you place a semicolon after the statement if (x < y) Selected Answer: A. the compiler will interpret the semicolon as a null statement Answers: A. the compiler will interpret the semicolon as a null statement B. All of these C. the if statement will always evaluate to false D. the code will not compile E. None of these Question 35 2 out of 2 points These operators connect two or more relational expressions into one, or reverse the logic of an expression. Selected Answer: D. logical Answers: A. negation B. irrational C. None of these D. logical E. relational Question 36 0 out of 2 points What is the value of the following expression? Selected Answer: B. fals e What is the value of the following expression? Selected Answer: B. fals e Answers: A. true B. fals e C. +1 D. -1 Question 37 2 out of 2 points What will be the output of the following code segment after the user enters 0 at the keyboard? What will be the output of the following code segment after the user enters 0 at the keyboard? Selected Answer: A. false Answers: A. false B. true C. x D. Nothing will be displayed. Question 38 2 out of 2 points What will the following segment of code output if 11 is entered at the keyboard? What will the following segment of code output if 11 is entered at the keyboard? Selected Answer: E. C++ is fun Answers: A. Soccerfun B. C++fun C. Soccer is fun D. C++ E. C++ is fun Question 39 0 out of 2 points What is the value of the following expression? true && true What is the value of the following expression? true && true Selected Answer: Answers: B. +1 A. fals e B. +1 C. tru e D. -1 Question 40 0 out of 2 points What is the value of the following expression? Selected Answer: Answers: A. -1 A. -1 Selected Answer: Answers: A. -1 A. -1 B. tru e C. fals e D. +1 Question 41 2 out of 2 points What will the following code display? int number = 6; number++; cout << number << endl; Selected Answer: D . 7 Answers: A . 6 Selected Answer: D . 7 Answers: A . 6 B . 5 C . 0 D . 7 Question 42 2 out of 2 points This is a special value that marks the end of a list of values. Selected Answer: B. sentinel Answers: A. None of these B. sentinel C. loop This is a special value that marks the end of a list of values. Selected Answer: B. sentinel Answers: A. None of these B. sentinel C. loop D. variable E. constant Question 43 0 out of 2 points This statement may be used to stop a loop's current iteration and begin the next one. Selected Answer: A. break Answers: A. break B. None of these C. return D. continue E. terminate Question 44 0 out of 2 points This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning. Selected Answer: Answers: D. dowhile A. while B. None of these C. for D. dowhile E. infinite Question 45 0 out of 2 points Something within a while loop must eventually cause the condition to become false, or a(n) ________ results. Selected Answer: B. compiler error Answers: A. infinite loop B. compiler become false, or a(n) ________ results. Selected Answer: B. compiler error Answers: A. infinite loop B. compiler error C. None of these D. null value E. unexpected exit Question 46 2 out of 2 points To allow file access in a program, you must #include this header file. Selected Answer: C. fstream Answers: A. fileacc ess B. file C. fstream D. cfile Question 47 0 out of 2 points What is the output of the following code segment? Selected Answer: Answers: A. 1 2 3 4 5 A. 1 2 3 4 5 B. 1 2 3 4 C. 2 3 4 5 D. 1 1 1 ... and on forever E. 2 3 4 5 6 Question 48 0 out of 2 points This is a variable that is regularly incremented or decremented each time a loop iterates. Selected Answer: C. None of these Answers: A. constant This is a variable that is regularly incremented or decremented each time a loop iterates. Selected Answer: C. None of these Answers: A. constant B. control statement C. None of these D. counter E. null terminator Question 49 2 out of 2 points A file must be ________ before data can be written to or read from it. Selected Answer: E. opened Answers: A. None of these B. initialized C. buffered D. closed E. opened A file must be ________ before data can be written to or read from it. Selected Answer: E. opened Answers: A. None of these B. initialized C. buffered D. closed E. opened Question 50 0 out of 2 points A for statement contains three expressions: initialization, test, and: Selected Answer: C. validation Answers: A. None of these B. null C. validation D. update E. reversal ...
View Full Document

  • Summer '17
  • Sophia Wilberscheid

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern