Walter McHenry C Programming Final-Exam

Ace your homework & exams now with Quizwiz!

2.33 Evaluate the expression 3 * 4 % 6 + 4 *5 (a) 20 (b) 26 (c) 12 (d) 32

(a)

3.4 Pseudocode does not include __________. (a) definitions (b) input/output (c) action statements (d) control structures

(a)

2.12. In a printf, a backslash is printed by enclosing in quotes a) \ b) \\ c) /\ d) //

(b)

3.3 Pseudocode 3.3 Which of the following is true of pseudocode programs? (a) they are executed by the computer (b) they help the programmer "think out" a program (c) they include definitions and all types of statements (d) all of the above are false

(b)

2.25. The address operator is a) && b) % c) @ d) &

(d)

1.10 Java 1.24 Java was developed by ___________. (a) Sun Microsystems (b) Bell Labs (c) IBM (d) ANSI/ISO

(a)

1.12 BASIC, Visual Basic, Visual C++, Visual C# and .NET 1.28 BASIC was developed by professors at ___________. (a) Dartmouth College (b) Massachusetts Institute of Technology (c) Columbia University (d) Cornell University

(a)

1.13 What is bandwidth? (a) information carrying capacity (b) response time (c) the set of networking protocols (d) an error-control technique

(a)

1.15 Hardware Trends 1.32 Over the past decades which of the following has occurred? (a) hardware costs have fallen rapidly (b) software costs have fallen rapidly (c) hardware costs have risen rapidly (d) none of the above

(a)

1.16 A computer can directly understand only its own ___________. (a) machine language (b) assembly language (c) high-level language (d) none of the above

(a)

1.2 Which of the following is going to be the key programming methodology for the next decade? (a) object-oriented programming (b) structured programming (c) "legacy C code" (d) "live-code approach"

(a)

1.23 C++ was developed by ________. (a) Bjarne Stroustrup (b) Ada Lovelace (c) Blaise Pascal (d) Ken Thompson

(a)

1.31 The linker creates __________. (a) an executable image (b) a preprocessor directive (c) object code (d) an input stream

(a)

1.4 Which of the following would not be considered hardware? (a) an operating system (b) a CPU (c) a keyboard (d) a disk

(a)

1.5 Computer programs are __________. (a) sets of control instructions (b) the information processed by the computer (c) the various devices (disks, memory, keyboard) that comprise a computer system (d) the people programming the computers

(a)

1.6 The Internet and the World Wide Web 1.11 An ancestor of today's Internet was _____________. (a) ARPAnet (b) e-mail (c) FORTRAN (d) Univac 1108

(a)

1.9 C++ 1.22 ________ are essentially reusable software components that model items in the real world. (a) objects (b) supersets (c) modules (d) developers

(a)

2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with _______________ let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d) <<

(a)

2.17 Which statement prints "hi" on the screen? (a) printf("hi"); (b) print "hi"; (c) printf "hi"; (d) none of the above

(a)

2.2 Which of the following must every C program have? (a) main (b) #include (c) /* (d) <stdio.h>

(a)

2.20. Which statement is false. a) Variables may be defined anywhere in the body of main. b) All variables must be defined. c) All variable definitions must include the name and data type of each variable. d) Several variable of the same data type may be defined in one definition.

(a)

2.28 When a number gets assigned to a variable that already has a value __________. (a) the new number overwrites the previous value at that memory location (b) the new number gets assigned to a neighboring memory location (c) the computer issues an error (d) the new value is destroyed and the old value remains

(a)

2.4 Memory Concepts 2.28 Variable names actually correspond to __________. (a) locations in the computer's memory (b) operators (c) integers (d) data types

(a)

2.40 Which of the following is an equality operator? (a) == (b) = (c) > (d) >=

(a)

2.46. Which statement is false? a) The assignment operator associates from left to right. b) The arithmetic operators associate from left to right. c) The equality operators associate from left to right. d) The relational operators associate from left to right.

(a)

2.6 Decision Making: Equality and Relational Operators 2.39 C's if statement executes the statement inside its body if a specified __________ is __________. (a) condition, true (b) condition, false (c) equality operator, true (d) relational operator, true

(a)

2.7. Which of the following statements about the inclusion of <stdio.h> is false? a) It is required. b) This header file contains information and declarations used by the compiler when compiling standard input/output library functions such as printf. c) This header file contains information that helps the compiler determine if calls to library functions have been made correctly. d) This header helps locate bugs in your program at compile time, rather than at execution time (when errors are usually more costly to correct).

(a)

3.10 How many types of control structures exist in C? (a) 3 (b) 7 (c) 5 (d) 2

(a)

3.13. Bohm and Jacopini's work demonstrated that all programs could be written in terms of only three control structures, namely sequence, __________ and repetition. a) selection b) serialization c) sorting d) searching

(a)

3.16. Flowchart symbols are connected by arrows called __________. a) flowlines b) flow of control c) flow delimiters d) darts

(a)

1.1 Introduction 1.1 Which of the following statements is true? (a) hardware controls software (b) software commands the computer to perform actions and make decisions (c) Pascal and C are object oriented programming languages (d) ANSI is the international standards institute

(b)

1.12 The technique by ARPA to allow multiple users to send and receive information at the same time over the same communications paths is known as ___________. (a) electronic mail (b) packet switching (c) networking (d) multitasking

(b)

1.14 Typical C Program Development Environment 1.30 The compile stage is when ____________. (a) the object code is linked with code for functions in other files (b) the C program is translated into machine language code (c) the program is executed one instruction at a time (d) the program is placed in memory

(b)

1.16 Notes About C and This Book 1.34 What does KIS stands for? (a) Keep In Sync (b) Keep It Simple (c) Keep Iterating Stuff (d) Keyword Interpreted Sequence

(b)

1.17 Assemblers__________. (a) convert machine language into high-level language. (b) convert assembly language into machine language. (c) convert high-level language into machine language. (d) convert high-level language into assembler language.

(b)

1.18 Programs that directly execute high-level language programs without compiling are called __________. (a) assemblers (b) interpreters (c) compilers (d) translators

(b)

1.25 What language(s) Java is based on? (a) B and BCPL (b) C and C++ (c) Smalltalk (d) FORTRAN

(b)

1.3 Computer Organization 1.6 Which of the following is not one of the six logical units of a computer? (a) input unit (b) programmer unit (c) memory unit (d) output unit

(b)

1.4 Personal, Distributed, and Client/Server Computing 1.9 When computing is spread over networks rather than performed at a centralized location, this is known as __________. (a) multiprogramming (b) distributed computing (c) personal computing (d) batch processing

(b)

1.6 Machine Languages, Assembly Languages, and High-level Languages 1.15 Which of the following is not a general programming language type? (a) machine languages (b) low-end languages (c) assembly languages (d) high-level languages

(b)

2.14. The escape sequence for horizontal tab is __________. a) \t ab b) \t c) \horizontaltab d) \T

(b)

2.18 The __________ sign is also known as the __________ operator. (a) +, assignment (b) =, assignment (c) *, stream manipulator (d) &, stream insertion

(b)

2.24. A(n) __________ error is caused when the compiler can not recognize a statement. a) logic b) syntax c) linkage d) execution

(b)

2.3 Every statement in C must end with a (a) period (.) (b) semicolon (;) (c) colon (:) (d) backslash (/)

(b)

2.31. Which of the following is false? a) Reading a value into a memory location destroys the previous value. b) Reading a value out of a memory location destroys that value. c) sum = integer1 + integer2; involves destructive read-in. d) The statement in part c) also involves nondestructive read-out.

(b)

2.34. Which statement is false? a) In algebra, we write ab to multiply a times b. b) In C, we write ab to multiply a times b. c) In C, the remainder operator is %. d) In C, integer division yields an integer result.

(b)

2.35. Which statement about C arithmetic is false? a) 6 / 3 yields 2 b) 5 / 2 yields 2.5 c) 7 % 3 yields 1 d) 6 % 3 yields 0

(b)

2.37. Which statement about precedence is false? a) Parentheses may be used to force the order of evaluation to occur in any sequence desired by the programmer. b) Nested, or embedded parentheses are evaluated last. c) Multiplication has a higher precedence than addition. d) Subtraction has a lower precedence than division.

(b)

2.38. Which expression is true? a) The expression a * (b + c) + c * (d + e) contains nested parentheses. b) The expression y = a * x * x + b * x + c is a second degree polynomial. c) The C standard library provides function power to perform exponentiation. d) When we say evaluation of an expression proceeds from left to right we are referring to the additivity of the operators.

(b)

2.42. Which statement is false? a) The relational operators associate left to right. b) An execution time error will occur if the two symbols in any of the operators ==, !=, >= and <= are separated by spaces. c) Confusing the == operator with = operator is typically an error. d) The equality operators associate left to right.

(b)

2.43. Which statement is false? a) Whitespace characters such as tabs, newlines and spaces are generally ignored by the C compiler. b) The statements in an if statement must be indented. c) Placing a blank line before and after every control structure can improve program readability. d) There can be (but should not be) more than one statement per line.

(b)

2.5 Arithmetic in C 2.32 Which operation will find the remainder when 15 is divided by 6? (a) 15 / 6 (b) 15 % 6 (c) 15 ^ 6 (d) 15 * 6

(b)

2.9. The pair of braces that delineate the body of main and the portion of the program between these braces is called a __________. a) function b) block c) statement d) header

(b)

3.14. Which statement is true? a) Unless directed otherwise, the computer automatically executes C statements one before the other. b) The sequence structure is essentially built into C. c) A flowchart is a pseudocode representation of an algorithm or a portion of an algorithm. d) Like pseudocode, flowcharts are useful for developing and representing algorithms, although flowcharts are preferred by most programmers.

(b)

1.10 Programs and data used in client/server computing are stored on __________. (a) personal computers (b) supercomputers (c) file servers (d) local area networks

(c)

1.11 Fortran, COBOL, Pascal and Ada 1.26 Which of the following is not true about COBOL? (a) it stands for common business oriented language. (b) a significant percentage of business software is still programmed in it. (c) it was developed in 1992. (d) COBOL is used for commercial applications that require precise and efficient manipulation of large amounts of data.

(c)

1.14 The World Wide Web (a) was developed at roughly the same time as the Internet (b) paved the way for the Internet (c) was developed years after the Internet (d) was designed for "stand-alone" computers

(c)

1.2 Computers: Hardware and Software 1.3 Today's fastest computers are called __________. (a) mega computers (b) terminals (c) supercomputers (d) CPUs

(c)

1.27 Which popular language was developed by IBM Corporation to be used for scientific and engineering applications that require complex mathematical computations? (a) Smalltalk (b) Pascal (c) FORTRAN (d) COBOL

(c)

1.7 History of C 1.19 Which of the following languages was an ancestor of C? (a) A (b) A+ (c) B (d) B+

(c)

1.7 The central processing unit (CPU) __________. (a) retains information so that the information can be readily available for processing. (b) performs calculations such as addition, subtraction, multiplication, and division. (c) supervises the operation of the other sections. (d) obtains information from input devices and places it at the disposal of other units.

(c)

1.8 Programs or data not actively being used by the other units are placed on the __________. (a) output unit. (b) memory unit. (c) secondary storage unit. (d) central processing unit.

(c)

2.10. Which of the following is not a synonym for a C string? a) message b) character string c) character d) literal

(c)

2.11. The following line is most properly an example of a __________. printf( "Welcome to C!" ); a) function b) block c) statement d) header

(c)

2.16 Which of the following is an invalid identifier (variable name)? (a) _Test (b) TEST (c) 5test (d) test1

(c)

2.19. A(n) __________ is a location in the computer's memory where a value can be stored for use by a program. a) unknown b) name c) variable d) declaration

(c)

2.22. Which of the following statements is false? a) C is case sensitive. b) Uppercase and lowercase letters are different in C. c) identifier and IdEnTiFiEr are identical identifiers in C. d) Identifiers can be of any length

(c)

2.23. Which of the following multiple word variable names does not conform to the good programming practices in the text? a) multiple_word_variable_name b) multipleWordVariableName c) multiplewordvariablename d) aReallyReallyLongMultipleWordVa

(c)

2.26. Which statement is false? a) in the statement sum = integer1 + integer2; both = and + are binary operators. b) The statement in part a) is an example of an assignment statement. c) The spaces around each of the binary operators in the statement of part a) are required. d) In part a), the = operator's two operands are sum and the value of the expression integer1 + integer2.

(c)

2.27. Which of the following is false? a) Each variable being input in a scanf statement is generally preceded by an &. b) Each variable being output in a printf statement is generally not preceded by an &. c) In a printf statement, the comma that separates the format control string from the expressions to be printed is placed inside the format control string. d) Calculations can be performed inside printf statements.

(c)

2.30. Every variable has all the attributes below, except a) name b) value c) alias d) type

(c)

2.4 Which of the following is not a valid escape sequence? (a) \n (b) \\ (c) \~ (d) \"

(c)

2.44. Which statement is false? a) It is not correct to split an identifier with a space, a tab or a newline. b) Statements and comments may be split over several lines. c) The equals sign (=) is not an operator. d) A good programming practice is to break a line after a comma in a lengthy comma-separated list.

(c)

2.48. Which is not a keyword? a) register b) volatile c) external d) struct

(c)

2.6. Lines beginning with a # are processed a) at execution time b) at compile time c) at preprocessor time d) at postprocessor time

(c)

3.1 Introduction 3.2 Algorithms 3.1 Specifying the order in which statements are to be executed in a computer program is called (a) an algorithm (b) transfer of control (c) program control (d) pseudocode

(c)

3.12. Various C statements enable the programmer to specify that the next statement to be executed may be other than the next one in sequence. This is called __________. a) change of order b) instruction skipping c) transfer of control d) rerouting

(c)

3.17. Small circle symbols in a flowchart are often called __________ symbols. a) little circle b) collision c) connector d) collator

(c)

3.2. The two key attributes of an algorithm are: a) actions and start activity b) flow and order of flow c) actions and order of actions d) flow and start activity

(c)

3.4 Control Structures 3.7 Which of the following encompasses the other three? (a) sequence structure (b) repetition structure (c) control structure (d) selection structure

(c)

3.5. Which statement is false? a) Pseudocode is an artificial and informal language that helps programmers develop algorithms. b) Pseudocode is similar to everyday English. c) Pseudocode is an actual programming language. d) Pseudocode programs are not actually executed on computers.

(c)

3.6. Which statement is false? a) Pseudocode helps the programmer "think out" a program before attempting to write it in a programming language such as C. b) Pseudocode programs consist purely of characters so programmers may conveniently type pseudocode programs into a computer using an editor program. c) A carefully prepared pseudocode program is only a beginning; it still takes a tremendous amount of work to convert a pseudocode program into a C program. d) Pseudocode consists only of action statements.

(c)

3.8 In a flowchart of an algorithm, what is the shape of the decision symbol? (a) circle (b) rectangle (c) diamond (d) oval

(c)

3.9 Which of the following is a repetition structure? (a) if (b) if...else (c) do...while (d) switch

(c)

1.13 Key Software Trend: Object Technology 1.29 Which of the following is not an advantage of object-oriented programming? (a) software is more reusable (b) software is more understandable and easier to maintain (c) programmers are able to model the real world (d) all of the above are advantages of object-oriented programming

(d)

1.21 Using standard library functions can be more efficient because __________. (a) they save programming time (b) they are carefully written to perform optimally (c) they increase program portability (d) all of the above.

(d)

1.33 The invention of the __________ in the late 1970s and 1980s laid the groundwork for the productivity improvements of the 1990s. (a) transistor (b) c (c) inexpensive hardware (d) microprocessor chip

(d)

1.8 C Standard Library 1.20 When programming in C you will typically use all of the following building blocks except __________. (a) functions from the standard library (b) functions you create yourself (c) functions other people have created for you (d) functions provided by ANSI / ISO

(d)

2.13. A linked program is often called a(n) __________. a) chain b) library c) object d) executable

(d)

2.21. Which of these is not a valid identifier? a) a_valid_identifier b) a1_valid_identifier c) a_valid_identifier_ d) 1_valid_identifier

(d)

2.3 Another Simple Program: Adding Two Integers 2.15 Which of the following is not a valid integer value? (a) -3 (b) 0 (c) 2134859 (d) 1.1

(d)

2.36. a * (b + c) may also be written in C as a) ab + ac b) (a * b ) + c c) a * b + c d) a * b + a * c

(d)

2.41. Which statement is false? a) Executable C statements either perform actions or make decisions. b) If the condition in an if statement is met, the statement in the body of the if statement is executed. c) All the relational operators have the same level of precedence. d) The equality operators have a higher level of precedence than the relational operators.

(d)

2.45. Which of the following is not a keyword? a) int b) return c) if d) main

(d)

2.47. The order in which statements are __________ is called flow of control. a) entered in a source file b) preprocessed c) compiled d) executed

(d)

2.5. Which statement about comments is false? a) Comments begin and end with /* and */, respectively. b) Programmers insert comments to document programs and improve program readability. c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

(d)

2.8. In the line int main() the parentheses indicate that main is a program building block called a a) module b) statement c) directive d) function

(d)

3.11. Normally, statements in a program are eexecuted one after the other in the order in which they are written. This is called __________ execution. a) inline b) seeking c) ordered d) sequential

(d)

3.15. The __________ flowchart symbol is also called the action symbol. a) small circle b) diamond c) oval d) rectangle

(d)

3.18. The diamond flowcharting symbol is also called the __________ symbol. a) determination b) derision c) declarative d) decision

(d)


Related study sets

solving one-variable inequalities

View Set

ATI TEAS 6 Review, Anatomy and Physiology (heart and blood vessels), Teas 6

View Set

How did each of the following contribute to the Industrial Revolution

View Set

Chapter 4: Life Insurance Policy Provisions, Options and Riders

View Set

HUN 2202 Nutrition & Diet Therapy Practice Questions-Chapter 6: Protein: Amino Acids

View Set

Unit 4: The Planets and Other Objects

View Set