Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.2 A Simple C Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (d)

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
2.2 A Simple C Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (d) 2.2 Every statement in C must end with a (a) perlod (.) semicolon G:) (b) (c) colon (:) (d) backslash (/) 2.5 Lines beginning with a # are processed a) at execution time. b) at compile time c) at preprocessor time. d) at postprocessor time. 2.6 Which of the following statements about the inclusion of stdio.h> is false? a) It is required. b) This header fle 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 de- termine if calls to library functions have been made correctly d) This header helps locate bugs in your program at compile time. ra- ther than at execution time (when errors are usually more costly to correct) 2.7 In the line int main() the parentheses indicate that main is a program building block called a) module b) statement c) directive d) function 2.10 The following line is most properly an example of a puts( "Welcome to cl") a) function b) block c) statement d) header 2.3 Another Simple C Program: Adding Two integers 2.14 Which of the following is not a valid integer value? (a) -3 (b) e (c) 2134859 2.16 Which statement prints "hi on the screen? (a) puts ("hi") (b) put "hi"; (c) puts "hi"; (d) none of the above sign is also known as the operator. 2.17 The (a) +, assignment (b) , assignment (c) ", stream manipulator (d) &, stream insertion 2.18 A(n)i value can be stored for use by a program. a) unknown b) name c) variable d) declaration is a location in the computer's memory where a 2.21 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 2.23 The address operator is a) && b) % c) @ d) & 2.24 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 2.24 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 integeri integer2. Chapter 2: Multiple Choice questions 2.25 Which of the following is false? a) Each variable being input in a scanf statement is generally pre- ceded 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 con- trol string from the expressions to be printed is placed inside the for- mat control string d) Calculations can be performed inside printf statements 2.4 Memory Concepts 2.4 Memory Concepts 2.27 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 2.28 Every variable has all the attributes below, except a) name b) value c) alias d) type 2.5 Arithmetic in C 2.30 Which operation will find the remainder when 15 is divided by 6? (a) 15 6 (b) 15 % 6 (c) 15 A 6 (d) 15 6 2.31 Evaluate the expression 3*4%6+4*5 (a) 20 (b) 26 (c) 12 (d) 32 2.32 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 2.33 Which statement about C arithmetic is false? ) 6 / 3 yields 2 b) 5/2 ylelds 2.5 c) 7 % 3 yields 1 d) 6 % 3 yields 0 2.34 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 2.35 Whch 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. 2.6 Decision Making: Equality and Relational Operators 2.37 Csif statement executes the statement inside its body if a specified (a) condition, true (b) condition, false (c) equality operator, true (d) relational operator, true is 2.38 Which of the following is an equality operator? 2.40 Which statement is false? a) Whitespace characters such as tabs, newlines and spaces are gen- erally 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. 2.41 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. 2.44 The order in which statements areis called flow of control. a) entered in a source file b) preprocessed c) compiled d) executed Chapter 2: Multiple Choice questions 2.7 Secure C Programming 2.45 Which of the following statements is true in secure C pro- gramming? (a) You should avoid using printf to display a single string argu- ment. (b) You should always use printf to display a single string argu- ment. (c) You should always use puts to display a single string argument. (d) None of the above. 2.46 Which of the following statements should be used in secure C programming to display the string "Welcome" not followed by a new- line character? (a) printf( "Welcome" ); (b) puts( "Welcome"); (c) printf( "%s", "Welcome" ); (d) None of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions