Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with practice questions! 1. The operators: & | ^ are: a) AND OR NOT b) AND OR XOR c) AND NOT NAND d)

Need help with practice questions! 1. The operators: & | ^ are: a) AND OR NOT b) AND OR XOR c) AND NOT NAND d) AND NOR XOR e) none of these 2. Well-written programs with identical purpose using only C syntax will tend to compile to smaller, faster load modules than programs using C++ objects. (T/F). 3. 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 4. TF Both malloc() and new[] return addresses. 5. C is an Object Oriented Programming (OOP) language. (T/F). 6. The C programming language's elements is compilable by an ISO compliant C++ compiler. (T/F). 7. 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 8. 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. 9. The constant "C" occupies how many bytes? a. 4 b. 3 c. 2 d. 1 e. none of the above 10. Many variables of the same Type, having the same Name, grouped together and referenced via an integer index constitute: a. a class. b. an array. c. a struct. d. a pointer. e. none of these. 11. 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 12. 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 13. Given: float f , g ; . . . the better choice of the two comparisons below would be: a. if (f >= g) b. if (f == g) 14. 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 15. If you want to read in the users data: (firstname, (maybe a middle) , lastname) 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 16. 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 17. 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 18. 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 19. The ifstream and ofstream objects are both examples of object creation by inheriting from the fstream object. (T/F). 20. sprintf() can translate between decimal, Hexadecimal, and Octal. (T/F). 21. 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 22. 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 23. To do array processing, it is necessary to know the size an array will be when you are writing the program. (T/F). 24. 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 25. An array may never be initialized at compile time a. true b. false 26. Suppose an array has been defined as int arr[3]; , can you use the expression arr++ ? a. yes b. no 27. To allocate a two-dimensional array, a definition like: int arf[50,50] is used. a. true b. false 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. An assignment statement itself has a value, just like a variable. (T/F) 30. 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 construction d. the body of the if statement is executed 31. 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 32. 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 33. It is possible to print decimal-point-aligned financial data without iomanip methods by using cout and the sprintf() function. (T/F). 34. A non-static global variable may be altered by functions which are declared in any source file included in the project. (T/F) 35. A static function may only be called by functions which are defined in the same source file. (T/F) 36. 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) 37. C variables declared inside a function {} are visible only to the calling routine. (T/F) 38. 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) 39. static_cast() is most similar to: a. (double *) b. (char *) c. (int) d. (double) e. none of these 40. One loop is often inserted inside another loop. (T/F) 

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

public or livery exclusion

Answered: 1 week ago