Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. When you pass an array as an argument to a function, what is actually passed? a. the address of the array b. the values

1. When you pass an array as an argument to a function, what is actually passed? a. the address of the array b. the values of the elements in the array c. a duplicate of the array d. the number of elements in the array e. none of the above 2. Many variables of the same Type, having the same Name, grouped together and referenced via an integer value constitute: a. a class. b. an array. c. a struct. d. a pointer. e. none of these. 3. A benefit of C++ is: a. reusable code via Inheritance. b. modularization via Encapsulation. c. abstraction thru the use of Templates. d. all of the above. e. none of these. 4. One of the methods NOT normally used to send data from the CALLED function to the CALLING function in C is: a. global variable b. pointer to variable in calling function c. instruction pointer register d. return value of called function e. none of the above 5. Object Oriented Programming uses "objects" which may contain: a. data b. executable code c. either data or executable code, not both d. both a and b plus other class objects e. none are true 6. C variables declared inside a function {} are visible only to the calling routine. (T/F) 7. Suppose an array has been defined as int arr[3]; , can you use the expression arr++ ? a. yes b. no 8. TF A function with no parameters or extern vars can only return a value with the "return" statement. 9. Given: main(int argc, char *argv[], char ** env) argv[0] is local only to main, and may not be directly seen or used by any other function. (T/F) 10. An array may never be initialized at compile time a. true b. false 11. sprintf() can translate between decimal, Hexadecimal, and Octal. (T/F). 12. C++ statements end with a ';' (semicolon). (T/F). 13. In building Unix, C was used for the kind of work that had previously only been done with Assembly Language.(T/F). 14. TF An assignment statement itself has a value, just like a variable. 15. C was developed from the BASIC language in 1970. (T/F). 16. A C/C++ function can only return one value (unless it returns a pointer to an array). (T/F). 17. TF Both malloc() and new[] return addresses. 18. How many bytes are taken up by 'C' and "C" respectively? a. 1, 1 b. 2, 2 c. 1, 2 d, 2, 1 e. none of these 19. Given: int a = 8 , b = 9 ; in order to get an accurate quotient, you must do: a. cout << a / b ; b. cout << (double) a / b ; c. cout << (double) (a / b) ; d. b or c above. e. they all produce an accurate answer. 20. A variable: a. always occupies 4 bytes b. can contain values of any type c. cannot have its contents changed once a value is assigned d. must be > 0 e. none of these 21. a. One C++ function can call another C++ function. b. Only main() can call other functions(). 22. The files which #include <> provides are human-readable text. (T/F). 23. Which option stores a 0 in int variable ch, assuming the address of ch has been assigned to the pointer fingerch? a. *fingerch = 0 ; b. int *fingerch = 0 ; c. *finger = 0 ; d. &ch = 0 ; e. *ch = 0 ; 24. Once you've fixed the compiler errors, the program is guaranteed to perform properly. (T/F). 25. Assuming that spread[] is a one-dimensional array of type int, which of the following refers to the value of the third element in the array? a. *(spread+4) b. spread[2] c. spread[3] d. spread+2 26. The C language is contained in C++. (T/F). 27. TF Computer programs can be written to write computer programs. 28. When you pass an array as an argument to a function, what is actually passed? a. the address of the array b. the values of the elements in the array c. a duplicate of the array d. the number of elements in the array e. none of the above 29. This switch statement: switch(num) { case 1: printf("Num is 1") ; case 2: printf("Num is 2") ; default: printf("Num is >2") ; } ; a. contains both logical and syntax errors b. contains only syntax errors c. contains only logical errors d. it's ok in my book e. huh? 30. TF For true randomness in a program, you must use the rand() function. 31. In an expression containing relational, assignment, and arithmetic operators, they will be executed in the order: a. assignment, relational, arithmetic b. arithmetic, relational, assignment c. relational, arithmetic, assignment d. assignment, arithmetic, relational e. none of the above. 32. TF "auto" variables defined in a function only exist while the function is running. 33. TF Code for member functions in a class can be written outside the class' braces with only their prototypes inside the class declaration. 34. TF A reference variable may be made to point to several different objects during the run of the program. 35. The entire C programming language is contained within the C++ programming language (T/F). 36. The statement following else in an if-else construction is executed when a. the conditional expression following if is false b. the conditional expression following if is true 37. If you want to read in the users name (first, (maybe a middle) , last) in a complete, single line from the keyboard, then parse that line later on, your usual method would be: a. cin >> b. cin.get() c. cin.getline() d. each is as good as the others e. only a and b would work 38. To print the address of x given: int x, * pt; pt = &x ; you would a. printf("%X ", pt) ; b. printf("%X ", &x) ; c. printf("%X ", *pt) ; d. a & b above e. none of the above 39. Variables of type "double" are used instead of integers to a. avoid being too specific about what value a number has b. make possible the use of large numbers c. permit the use of decimal points in numbers d. conceal the true value of the numbers 40. When a variable is defined inside of a { } block, it cannot be seen or changed from outside that block. (T/F). 41. static_cast() is most similar to: a. (double *) b. (char *) c. (int) d. (double) e. none of these 42. TF C++ variables declared inside a function {} are visible only to the calling routine. 43. Which of these arrays takes up more memory space on buffy? a. int a[5] ; b. long [2] ; c. char s[81] = {"Oh, woe!"} ; d. int * ip[2] ; e. impossible to tell 44. When dealing with arrays, you will most often use: a. while loops b. for loops c. do while loops d. typecasts e. none of these are related to arrays 45. TF Given an array int arr[3]; , you can use the expression arr++. 46. Preprocessor directives take effect at a. pre-compile time b. run time c. lunch time d. edit time e. no answer can be certain 47. Given: float f , g ; . . . the better choice of the two comparisons below would be: a. if (f >= g) b. if (f == g) 48. The #ifdef, #elif, #else, and #endif constructs are used to: a. decide what code the compiler includes in the program b. control program execution at run time c. pass arguments back to dos during program execution d. both a and b above e. all of the above 49. In a simple if statement with no else, what happens if the condition is false? a. the program searches for the last else in the program b. nothing c. control "falls through" to the statement following the if body d. the body of the if statement is executed 50. TF given: myclass::downsize() { starts the function definition (source code) for a method whose prototype appears in a class declaration. 51. If there is a global variable int x ; and within function fi() we find the definition: float x = 0.1 ; we know that this: a. forces the global to be a float b. still means the local variable is an int c. makes the global variable "invisible" to the function fi() d. sets the global variable to 0 e. none of the above 52. The source code for one C++ function cannot contain the source code for another ("nested") C++ function. (T/F). 53. TF It is possible to successfully write a function yet not know how many parameters will be passed to it by the calling routine. 54. TF A union allows several different types of variable to share the same memory. 55. The constant "C" occupies how many bytes? a. 4 b. 3 c. 2 d. 1 e. none of the above 56. In C standard library I/O, the function used to disconnect a FILE * pointer from the disk hardware after writing is: a. fclose() b. close() c. unlink() d. chmod() e. none above 57. The wchar_t data type is for storing: a. graphics b. ASCII c. Unicode d. large objects e. none of these 58. The character ' ' causes the display of text to skip to the next line. (T/F). 59. TF Polymorphism consists of having several methods or functions with the same name and different argument lists. 60. The purpose of the " ? : " operator is to: a. select the highest of the two values b. select the more equal of two values c. select one of two values alternately d. select one of two values depending on a condition e. none of the above 61. In a valid program, what will the following statement print: cout << ((2 + 1) < 4) << endl ; a. "1", because < means subtract b. "1", because 1 is true and 0 is false c. nothing, because the statement will cause an error d. "7", because < means add e. huh? 62. A single-statement for loop is terminated with a a. right bracket ] b. right parenthesis ) c. comma , d. semicolon ; 63. A static function may only be called by functions which are defined in the same source file. (T/F) 64. TF Data inside a class may be hidden from access by functions outside the class body. 65. Every C program must have one and only one function named MAIN() (T/F) 66. The ifstream and ofstream objects are both examples of object creation by inheriting from the fstream object. (T/F). 67. On Buffy, when you don't use "-o" with cc or g++, the default name for the executable is "a.out". (T/F). 68. An assignment statement itself has a value, just like a variable. (T/F) 69. The file  is: a. a binary library b. a shell script c. a header file d. a and c above e. all above 70. TF: int y, x = 8 ; y = x++ ; will store a 9 in y. 71. Because of the execution of the statements: char ar[500]; char a, b, c ; the GNU compiler will set aside a. 500 bytes b. 501 bytes c. 502 bytes d. 503 bytes e. Cannot be determined. 72. TF The main reason to prefer open() / read() / write() over fopen() fread() / fwrite() is speed of execution 73. The #ifdef, #elif, #else, and #endif constructs are used to: a. control program execution at run time b. pass arguments back to the o/s during program execution c. decide what code the compiler includes in the program d. both a and b above e. all of the above 74. TF Given: struct prs { char name[30]; int num; } ; it is acceptable to define and initialize a variable at compile time thus: struct prs agent = {"James Bond", 007}; 75. Escape characters are preceeded by: a. \ b. / c. ^ d. & e. ~ 76. A non-static global variable may be altered by functions which are declared in any source file included in the project. (T/F) 77. Define: Pass by Reference: a. pass a copy of the variable's contents on the stack b. pass the address of the variable on the stack c. write a temp file to disk d. write a temp buffer to working storage e. none of the above 78. Programs with identical purpose using only C syntax will tend to run faster than programs using C++ objects and inheritance. (T/F). 79. The Order of Execution (simplified) is: a. Assignment, Relational, Function Call b. Arithmetic, Assignment, Relational c. Arithmetic, Relational, Assignment d. Relational, assignment, Arithmetic e. Assignment, Relational, Arithmetic 80. Define: Pass by Value a. pass a copy of the variable's contents on the stack b. pass the address of the variable on the stack c. write a temp file to disk d. write a temp buffer to working storage e. none of the above 81. When class properties (data) are declared private: they can be altered or accessed via: a. static global functions b. public methods of the class c. other methods of the class d. b or c above e. none of these 82. TF Given: int main(int argc, char *argv[]) argv[0] is local only to main, and may not be directly seen or used by any other function. 83. Without considering endianness, (pretend it's a Little Endian machine) in negative integral variables, the leftmost bit is always '1'; 84. TF Code::Blocks provides both compiler and debugger capabilities. 85. TF C++ string objects can grow larger or smaller as they are used. 86. It is possible to print decimal-point-aligned financial data without iomanip methods by using cout and the sprintf() function. (T/F). 87. The statements following else in an if-else construction are executed when a. the conditional expression following if is false b. the conditional expression following if is true 88. All braces that surround code in a C program a. delimit a section of code b. show what code goes in a particular function c. separate the code from the constants d. separate the source file from the object file 89. When searching a sorted array: a. linear searching is more efficient b. binary searching is more efficient c. efficiency is a function of array type d. binary is faster only if it is an array of floats e. none of these are true 90. TF The switch() produces faster-executing code than several if()'s. 91. The Internet spread as fast as it did because Unix was written in C instead of Assembler. (T/F). 92. A static int variable is allocated only once in the run of the program, and keeps its value between calls of the function in which it is defined. (T/F) 93. cout and printf: a. allow programs to talk to users b. allow users to provide information to programs 94. What will happen if you assign a value to an element of an array whose subscript exceeds the size of the array? a. the element will be set to zero b. nothing, it's guaranteed to be safe by the C runtime c. other data may be overwritten without warning d. the system will flag an error and abort the run e. either c or d may occur. 95. The code: int x = 9 ; cout << ++x ; will print: a. 10 b. 9 c. 8 d. 1 e. error 96. To allocate a two-dimensional array, a definition like: int arf[50,50] is used. a. true b. false 97. C and C++ are languages in which the programmer writes readable source code which is then compiled into an executable binary. (T/F) 98. Given: int a[10][5] ; to access the second item in the 3rd row, we would use: a. a[2][3] ; b. a[3][2] ; c. *(*(a+3)+2) ; d. *(*(a+2)+1) ; e. none above 99. To copy the contents of int b[200] to int a[200], you would: a. a = b ; b. memcpy(a, b, sizeof(a)) ; c. use a correctly written for() loop d. b or c above e. a, b, or c above 100. TF One of the reasons for using classes is that code may be more easily re-used instead of re-written. 

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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

How many three-digit numbers are divisible by 7?

Answered: 1 week ago

Question

What is Indian Polity and Governance ?

Answered: 1 week ago

Question

Describe three other types of visual aids.

Answered: 1 week ago