Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. The operators: & | ^ are: a) AND OR NOT b) AND OR XOR c) AND NOT NAND d) AND

ID: 3770976 • Letter: 1

Question

 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.  Strings are objects, not types. (T/F)  3.  Classes are blueprints for objects. (T/F)       4. Both malloc and new return addresses. (T/F)  5. Objects combine both data and programs in one bundle. (T/F)  6. C++ requires the use of objects when writing application programs. (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, it's stored on the Stack.      10. 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.  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 write a statement to read in the users name (first, (maybe a middle) , last) from the keyboard, your usual method would be:          a. cin >> namevar         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 Preprocessor reads in machine language programs that save us repetitive coding. (T/F)       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  If the file path is inclosed in double quotes, the Preprocessor looks in the absolute or relative path specified between the quotes. (T/F)  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 using cout using 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 global 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<double>() is most similar to:  a. (double *) b. (char *) c. (int) d. (double) e. none of these       40.     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.  41. Encapsulation allows hiding how things work and only revealing the controls. (T/F)  42. Abstraction means using a model that feels like the real thing to manage complexity. (T/F)  43. Basic operators like '=' and '+' may never be overloaded. (T/F)  44. Each C++ program has a *.cpp file containing main(). (T/F)  45. The std::string::c_str() method returns a pointer the the string object. (T/F)  46. The signed char V  contains: 11111110  This number is negative. (T/F)  47. Vectors have the same usage as arrays, but they expand to the size you need.  48. The code:    Charlie::scramble(x.begin(), x.end()) ;     futz.scramble(y.begin(), y.end()) ;              a) runs a member function, then a static function.                    b) runs a static function, then a member function.  49.  Objects may give birth to other Objects, either from solo inheritance, or by multiple inheritance. (T/F)  50. Every C program must have one and only one function named MAIN() (T/F) 

Explanation / Answer

1)a-> AND OR NOT

2)F-> Strings are Types not objects

3)T-> classes are blueprints for objects

4)F-> malloc only returns address and new doesnot returns any addresses.

5)T->object combines both data and programs.

6)T-> c++ usex the OOps concepts when it needs to write application programs.

7)C->instruction pointer register.

8)d-> all of the above.It uses inheritance,data encapsulation and templates.

9)e-> It store on the stack.

10)b->array

11)b-> pass the address of the variable on the stack.

12) a-> pass a copy of the variable's contents on the stack.

13) a->f (f >= g).

14) d-> b or c above.

15) d->each is as good as the others.

16)b->a[3][2].

17) T

18)a

19)T

20)T

21)F

22)D

23)T

24)D

25)T

26)B

27)B

28)B

29)F

30)D

31)D

32)B

33)F

34)F

35)T

36)T

37)T

38)T

39)A

40)D

41)F

42)T

43)F

44)F

45)T

46)T

47)T

48)b.

49)T

5o)T-> every C program should have main() function.