CS 159

Ace your homework & exams now with Quizwiz!

x==y && x != z !(x != y || x==z)

2 complements of the logical expression below? !(x==y || x != z)

A

According to course standards, which of the following will be least likely to be in main? A) specific logic for most of the calculations B) variable declarations of important variables C) calls to the user-defined functions of the program D) none of the above

C

Given that both operands in the following expression are non-negative, which of the following is a not possible resulting value? B % A A) B B) A - 1 C) A D) None of the above

B

Given the logical expression below: x && y Where x and y are integer variables, which of the following logical expressions is not a complement? A) !(x && y) B) x || y C) !x || !y D) None of the above.

0

What is the result of 0%4%5?

D

Which is false about UDF's? A) it should not be designed such that it completes multiple tasks B) should eliminate the need for same logic to appear in more than one program C) should be testable apart from the rest of the program D) none of the above

D

Which is false regarding data types? A) The data type of a variable will determine those operators with which it may be used B) The data type actually stored by a variable cannot be altered during the execution of the program C) The data type of a variable will determine the amount of memory to reserve D) none of the above

B

Which is true about UDF's? A) control of the program returns from the calling function to main B) data sent to the calling function to the function being called will be received in the same order it was passed C) the return statement cannot contain an expression D) none of the above

B

Which is true about parameter passing and course standards? A) A function that passes at least one parameter by address must pass them all by address B) When only one data item needs to be returned then we should use the standard return statement rather than passing by address C) With the use of pass by address a function can be written to complete several sub-tasks of a program D) none of the above

C

Which is true about random number generation? A) The srand function will return a random number B) the random function will return a random number C) the rand function will return a random number D) none of the above

B

Which is true regarding printf and scanf? A) A single scanf statement cannot be used to accept input for multiple variables B) it is possible to format data output with left alignment in printf C) a scanf statement will return the value entered by the user of the program D) none of the above

C

Which of the following about UDF's is true? A) The declaration does not require the data types for each parameter B) The call requires the data types and identifiers C) The definition requires the data types and identifiers D) none of the above

D

Which of the following about UDF's is true? A) the order in which definitions appear must match the order in which they are declared B) the order in which declarations appear must match the order in which they are defined C) the order in which definitions appear must match the order in which they are called D) none of the above

A

Which of the following about data type conversions is false? A) Both implicit and assignment in an expression will not result in a loss of data B) when evaluating operators, the lower ranked data type is converted to a higher one C) converting a higher to a lower data type may result in loss of data D) none of the above

A

Which of the following about printf is true? A) the flag attribute could shift the alignment when making use of a width modifier B) Precision modifier always requires whenever a width modifier is specified C) precision modifier can specify number of digits on both sides of the decimal point D) none of the above

C

Which of the following about x %= 0 where x is a positive integer is true? A) evaluation of this expression will be the value of x B) evaluation of this expression will be zero C) evaluation of this expression will be a run time error D) none of the above

A

Which of the following are not examples of run time errors? A) missing semicolon at the end of an expression B) division by variable containing zero C) failing to include the address operator when using scanf D) more than one above

A (the asterisks by the data type)

Which of the following can always be determined from the declaration of a UDF? A) the parameters that should be passed by address B) exact order in the program that the UDF will be called C) number of parameters that will be passed as constant values D) none of the above

D

Which of the following can never be used to determine if a function has a parameter that is passed by address? A) The function call. B) The function declaration. C) The function definition. D) None of the above.

A

Which of the following correctly describes how the rand function is properly seeded? A) The srand function is passed a single value and used only prior to the first call of the rand function. B) The value returned from the srand function is the seed used with the rand function. C) The srand function should be called prior to each use of the rand function. D) None of the above.

D (pass by address)

Which of the following data conversions has the ability to alter the data type a variable stores in memory? A) Explicit B) Implicit C) Assignment Conversion D) none of the above

C

Which of the following is a course standard? A) all code needs to be indented two space B) semi-colons are required at the end of every line of code C) every variable needs to have a comment describing what it does D) all code needs #include <stdio.h> at the top of the code

A

Which of the following is an invalid line of code? A) x += x++ B) x %= x C) x = (x+2) - 2*x D) all of the above are acceptable

A

Which of the following is correctly describes when an identifier of a variable can be reused in a program with regard to course standards? A) Variables with scope that does not overlap can use the same identifier name while remaining two distinct variables. B) Two variables in the same function can use the same identifier name if they have been declared to be of different data types. C) A local variable and a global variable can use the same identifier name as they have been declared in two different locations of the program. D) None of the above.

B

Which of the following is false about explicit type conversions? A) an assignment type conversion may result in a higher ranked data type being converted into a lower one B) explicit can only be applied to variables and not to literal or defined constants C) result of explicit may include loss of data when a higher ranked data type is converted to a lower ranked data type D) none of the above

B

Which of the following is false about structure charts? A) whether a given UDF is called more than once is indicated on the structure chart B) a detailed flowchart of the logic within each user-defined function is displayed in the structure chart C) those functions utilized from the standard libraries such as stdio.h and math.h are not indicated on a structure chart

A

Which of the following is true regarding pass by address and course standards? A) The called function can access and modify the value of variables in the calling function that were passed by address B) use of pass by address allows the consolidation of multiple tasks into single UDF's C) a well designed UDF that uses pass by address will always be void D) none of the above

D (can't divide by zero)

Which of the following is true regarding x %= 0 where x is an integer? A) result would be the value of x B) result would be zero C) result would be zero if x is nonzero D) none of the above

D

Which of the following is true? A) The compiler handles integer and characters differently B) when doing math with different types the lower value type does not get promoted C) C rounds up D) every function needs a header

A

Which of the following languages was developed to be the most independent of the specific hardware on which it was used? A) High level B) Low level C) Machine D) None of the above

C

Which of the following regarding attributes of a placeholder used with a printf statement is false? A) The width modifier is used to specify the minimum number of positions to reserve for data to be output B) A precision modifier may be used for, and is limited to, the output of floating-point data C) When used with integer data the size modifier can limit the total number of digits to display D) none of the above

C

Which of the following regarding course standards related to functions is false? A) The role of the main function is to coordinate the function calls and establish the data needs of a program B) A course header for every function must be inserted immediately above its definition C) Parameters received by the function will be commented to the right of where they are defined D) none of the above

B

Which of the following regarding expressions is false? A) an expression always reduces to a single value B) if multiple variables are modified once in an expression then the result is undefined C) the left operand in an assignment expression must be a single variable D) none of the above

A

Which of the following regarding placeholders in printf is false? A) If the width modifier is too small for the whole number portion then those digits will be truncated B) The width modifier can be used with values in either the floating-point or integer family C) The size modifier is always required with longer numeric data types D) None of the above

A

Which of the following regarding the programming and documentation standards of the course is true? A) local declaration and executable statement sections in all functions must never overlap B) parameters of a user-defined function are commented to the right of where they are declared C) the UDF declarations must appear in the same order in which they are defined following the main function D) none of the above

B

Which of the following regarding the structure of a program is true? A) Within each function it is permissible by course standards that a local declaration be places within the executable statements when the declaration is accompanied by an initialization B) All code found in the executable statement and local declaration sections of a function is considered to comprise the body of the function C) Course standards prohibit function declarations to appear in the global declaration section of a program D) none of the above

D

Which of the following regarding the use of user-defined functions is a requirement of the course? A) Functions must be called in the same order in which they are declared. B) Functions must be called in the same order in which they are defined following the main function. C) Functions must both be declared and defined in the same order in which they are called. D) None of the above.

B (declarations don't need names)

Which of the following regarding user defined function declarations and course standards is true? A) variable names in the declaration must match those in the definition B) data types of parameters in the declaration must match those in the definition C) both names and data types must match in the declaration and definition D) none of the above

A

Which of the following statements about UDF's is false? A) a variable locally declared in a function can have the same identifies as one of the parameters within the same function B) data sent from the calling function to the called function will be received in the same order as it was passed C) parameters are defined as local variables in the first line of the function definition so should not be locally declared again inside the function D) none of the above

C

Which of the following statements about parameters and local variables is false? A) parameters are defined in the first line of the function definition B) parameters in the function definition are initialized by the value they receive from the calling function C) a variable declared in the local declaration section of a function can have the same identifier as one of the parameters of the same function D) none of the above

A (RAM = northbridge) (USB, CD, hard drive = south bridge)

Which of the following statements regarding computer memory and storage is true? A) Accessing RAM is faster than accessing USB B) accessing CD ROM is faster than accessing accessing RAM C) Accessing a conventional hard drive is faster than accessing RAM D) none of the above

A (Primary storage)

Which of the following statements regarding computers is FALSE? A) Secondary storage is the place that temporarily stores programs and data for the quickest retrieval. B) Each computer has its own machine language which is made of streams of 0's and 1's. C) High-level programming languages are portable to many different computers. D) None of the above.

A

Which of the following statements regarding expression evaluation is true? A) The result of an expression is undefined when it attempts to modify a single variable more than once B) When evaluating an assignment operator with mixed data types, the lower ranked data type is always converted to that of a higher rank C) An implicit type conversion is the programmer directly specifying the data type of an operand in an expression D) none of the above

D

Which of the following statements regarding passing parameters by address is FALSE? A) The asterisk when used in a variable declaration indicates that such variables are address (pointer) variables which can store the addresses of other variables in the program. B) The asterisk when used in an expression permits the accessing of data in the memory location to which the variable points. C) Given the address of a variable, the called function has the capability to access and manipulate the value of a variable in the calling function. D) None of the above.

D

Which of the following statements regarding programming languages is false? A) A high level programming language allows the programmer to concentrate on the problem at hand rather than the machine the program will be using B) The C programming language is a high level language even though its origin is decades old C) A high level programming language language will borrow familiar terms from a natural language to make it easier to understand and utilize D) none of the above

B

Which of the following statements regarding symbolic/defined constants and course standards is TRUE? A) A symbolic/defined constant should be use camel casing to distinguish them from variable names. B) Problems associated with defined constants could be difficult to resolve as the programmer does not view the statement with the error after the substitution takes place. C) Creation of a symbolic/defined constant should be made in the same function within which it will be used. D) None of the above.

C

Which of the following statements regarding the appropriate use of passing parameters by address is FALSE? A) Passing parameters by address is appropriate when the function provides multiple changes that are needed back in the calling function. B) Passing parameters by address is appropriate when a non-void function needs to communicate a second value with the calling function. C) Passing parameters by address is appropriate when consolidating multiple tasks in a single function results in less code than if each task was coded as separate functions. D) None of the above.

B

Which of the following statements regarding the main function in a C program is TRUE? A) Only code found after the variable declarations of the main function is considered to be the body of the function. B) The return statement in main will return control to the operating system and terminate the current program. C) The gcc compiler as found on guru will specify that the main be a void function without parameters. D) None of the above.

B

Which of the following statements regarding the scanf statement is TRUE? A) A single scanf statement cannot be used to accept input for multiple values. B) Each use of the scanf function will contain both a format string and address list. C) It is possible to make use of the scanf function to both accept input and generate output. D) None of the above

D

Which of the following statements regarding type conversions is FALSE? A) When the data types of two operands for the division operator are different, the lower-ranked type is promoted to the rank of the higher type. B) In an assignment statement, promotion occurs if the right expression has a lower rank than the variable on the left and demotion occurs if the right expression has a higher rank. C) An explicit type conversion is the programmer taking control and specifying the data type of an operand in an expression. D) None of the above.

A

Which of the following would be an invalid identifier? A) 1stInput B) _input1 C) firstInput D) none of the above

D

Which of the following would be the result of an attempt to print a floating point value using a character conversion code? A) result in program failing to compile B) will display integer portion of the number C) will display the ASCII character representing the fractional portion of the number D) none of the above

D

Which of the following would not be found as part of the data list of a printf function? A) an expression using multiple operators and operands B) a UDF C) a symbolic/defined constant D) none of the above

C

Which of the following would you be able to determine from a structure chart for a program? A) The data types of the parameters passed to each UDF B) The logic for each UDF C) The identification of the calling function for each UDF function call

D

Which would be the correct usage of a return statement within a void function? A) Return void; B) return 0; C) A return statement cannot be used with a void function D) none of the above


Related study sets

Chapter 29: Management of Patients With Complications from Heart Disease

View Set

Usual, Customary, and Reasonable

View Set

Chapter V: Civil Rights and Public Policy

View Set