Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.30 KB | None | 0 0
  1.  
  2.  
  3. Question 1 (1 point)
  4. Question 1 Unsaved
  5.  
  6.  
  7. A function ________ eliminates the need to place a function definition before all calls to the function.
  8. Question 1 options:
  9.  
  10.  
  11.  
  12. A) header
  13.  
  14.  
  15.  
  16. B) prototype
  17.  
  18.  
  19.  
  20. C) parameter
  21.  
  22.  
  23.  
  24. D) argument
  25.  
  26.  
  27.  
  28. E) None of these
  29.  
  30. Save
  31.  
  32.  
  33. Question 2 (1 point)
  34. Question 2 Unsaved
  35.  
  36.  
  37. If a function does not have a prototype, default arguments may be specified in the function ________.
  38. Question 2 options:
  39.  
  40.  
  41.  
  42. A) execution
  43.  
  44.  
  45.  
  46. B) return type
  47.  
  48.  
  49.  
  50. C) call
  51.  
  52.  
  53.  
  54. D) header
  55.  
  56.  
  57.  
  58. E) None of these
  59.  
  60. Save
  61.  
  62.  
  63. Question 3 (1 point)
  64. Question 3 Unsaved
  65.  
  66.  
  67. This is a collection of statements that performs a specific task.
  68. Question 3 options:
  69.  
  70.  
  71.  
  72. A) infinite loop
  73.  
  74.  
  75.  
  76. B) constant
  77.  
  78.  
  79.  
  80. C) function
  81.  
  82.  
  83.  
  84. D) variable
  85.  
  86.  
  87.  
  88. E) None of these
  89.  
  90. Save
  91.  
  92.  
  93. Question 4 (1 point)
  94. Question 4 Unsaved
  95.  
  96.  
  97. This is a dummy function that is called instead of the actual function it represents.
  98. Question 4 options:
  99.  
  100.  
  101.  
  102. A) main function
  103.  
  104.  
  105.  
  106. B) driver
  107.  
  108.  
  109.  
  110. C) overloaded function
  111.  
  112.  
  113.  
  114. D) stub
  115.  
  116. Save
  117.  
  118.  
  119. Question 5 (1 point)
  120. Question 5 Unsaved
  121.  
  122.  
  123. Look at the following function prototype.
  124.  
  125. int myFunction(double);
  126.  
  127. What is the data type of the function's return value?
  128. Question 5 options:
  129.  
  130.  
  131.  
  132. A) void
  133.  
  134.  
  135.  
  136. B) int
  137.  
  138.  
  139.  
  140. C) double
  141.  
  142.  
  143.  
  144. D) Can't tell from the prototype
  145.  
  146.  
  147.  
  148. Question 6 (1 point)
  149. Question 6 Unsaved
  150.  
  151.  
  152. A function is executed when it is:
  153. Question 6 options:
  154.  
  155.  
  156.  
  157. A) prototyped
  158.  
  159.  
  160.  
  161. B) called
  162.  
  163.  
  164.  
  165. C) declared
  166.  
  167.  
  168.  
  169. D) defined
  170.  
  171.  
  172.  
  173. E) None of these
  174.  
  175. Save
  176.  
  177.  
  178. Question 7 (1 point)
  179. Question 7 Unsaved
  180.  
  181.  
  182. When used as parameters, these types of variables allow a function to access the parameter's original argument.
  183. Question 7 options:
  184.  
  185.  
  186.  
  187. A) floating-point
  188.  
  189.  
  190.  
  191. B) undeclared
  192.  
  193.  
  194.  
  195. C) counter
  196.  
  197.  
  198.  
  199. D) reference
  200.  
  201.  
  202.  
  203. E) None of these
  204.  
  205. Save
  206.  
  207.  
  208. Question 8 (1 point)
  209. Question 8 Unsaved
  210.  
  211.  
  212. These types of arguments are passed to parameters automatically if no argument is provided in the function call.
  213. Question 8 options:
  214.  
  215.  
  216.  
  217. A) Relational
  218.  
  219.  
  220.  
  221. B) Local
  222.  
  223.  
  224.  
  225. C) Default
  226.  
  227.  
  228.  
  229. D) Global
  230.  
  231.  
  232.  
  233. E) None of these
  234.  
  235. Save
  236.  
  237.  
  238. Question 9 (1 point)
  239. Question 9 Unsaved
  240.  
  241.  
  242. Which line in the following program contains a call to the showDub function?
  243.  
  244. 1 #include
  245. 2 using namespace std;
  246. 3
  247. 4 void showDub(int);
  248. 5
  249. 6 int main()
  250. 7 {
  251. 8 int x = 2;
  252. 9
  253. 10 showDub(x);
  254. 11 cout << x << endl;
  255. 12 return 0;
  256. 13 }
  257. 14
  258. 15 void showDub(int num)
  259. 16 {
  260. 17 cout << (num * 2) << endl;
  261. 18 }
  262.  
  263. Question 9 options:
  264.  
  265.  
  266.  
  267. A) 4
  268.  
  269.  
  270.  
  271. B) 6
  272.  
  273.  
  274.  
  275. C) 10
  276.  
  277.  
  278.  
  279. D) 15
  280.  
  281. Save
  282.  
  283.  
  284. Question 10 (1 point)
  285. Question 10 Unsaved
  286.  
  287.  
  288. Look at the following function prototype.
  289.  
  290. int myFunction(double, double, double);
  291.  
  292. How many parameter variables does this function have?
  293. Question 10 options:
  294.  
  295.  
  296.  
  297. A) 1
  298.  
  299.  
  300.  
  301. B) 2
  302.  
  303.  
  304.  
  305. C) 3
  306.  
  307.  
  308.  
  309. D) Can't tell from the prototype
  310.  
  311.  
  312. Question 11 (1 point)
  313. Question 11 Unsaved
  314.  
  315.  
  316. It is a good programming practice to ________ your functions by writing comments that describe what they do.
  317. Question 11 options:
  318.  
  319.  
  320.  
  321. A) prototype
  322.  
  323.  
  324.  
  325. B) eliminate
  326.  
  327.  
  328.  
  329. C) document
  330.  
  331.  
  332.  
  333. D) execute
  334.  
  335.  
  336.  
  337. E) None of these
  338.  
  339. Save
  340.  
  341.  
  342. Question 12 (1 point)
  343. Question 12 Unsaved
  344.  
  345.  
  346. A ________ variable is declared outside all functions.
  347. Question 12 options:
  348.  
  349.  
  350.  
  351. A) local
  352.  
  353.  
  354.  
  355. B) counter
  356.  
  357.  
  358.  
  359. C) global
  360.  
  361.  
  362.  
  363. D) floating-point
  364.  
  365.  
  366.  
  367. E) None of these
  368.  
  369. Save
  370.  
  371.  
  372. Question 13 (1 point)
  373. Question 13 Unsaved
  374.  
  375.  
  376. A function can have zero to many parameters, and it can return this many values.
  377. Question 13 options:
  378.  
  379.  
  380.  
  381. A) no
  382.  
  383.  
  384.  
  385. B) zero to many
  386.  
  387.  
  388.  
  389. C) a maximum of ten
  390.  
  391.  
  392.  
  393. D) only one
  394.  
  395.  
  396.  
  397. E) None of these
  398.  
  399. Save
  400.  
  401.  
  402. Question 14 (1 point)
  403. Question 14 Unsaved
  404.  
  405.  
  406. What is the output of the following program?
  407.  
  408. #include
  409. using namespace std;
  410.  
  411. void doSomething(int&);
  412.  
  413. int main()
  414. {
  415. int x = 2;
  416.  
  417. cout << x << endl;
  418. doSomething(x);
  419. cout << x << endl;
  420. return 0;
  421. }
  422.  
  423. void doSomething(int& num)
  424. {
  425. num = 0;
  426. cout << num << endl;
  427. }
  428.  
  429. Question 14 options:
  430.  
  431.  
  432.  
  433. A) 2
  434. 2
  435. 2
  436.  
  437.  
  438.  
  439.  
  440. B) 2
  441. 0
  442. 2
  443.  
  444.  
  445.  
  446.  
  447. C) 2
  448. 0
  449. 0
  450.  
  451.  
  452.  
  453. D) 0
  454. 0
  455. 0
  456.  
  457.  
  458. Save
  459.  
  460.  
  461.  
  462.  
  463.  
  464. Question 15 (1 point)
  465. Question 15 Unsaved
  466.  
  467.  
  468. This vector function removes an item from a vector.
  469. Question 15 options:
  470.  
  471.  
  472.  
  473. A) pop_back
  474.  
  475.  
  476.  
  477. B) remove_item
  478.  
  479.  
  480.  
  481. C) erase
  482.  
  483.  
  484.  
  485. D) delete_item
  486.  
  487.  
  488.  
  489. Question 16 (1 point)
  490. Question 16 Unsaved
  491.  
  492.  
  493. A two-dimensional array can have elements of ________ data type(s).
  494. Question 16 options:
  495.  
  496.  
  497.  
  498. A) one
  499.  
  500.  
  501.  
  502. B) four
  503.  
  504.  
  505.  
  506. C) two
  507.  
  508.  
  509.  
  510. D) Any of these
  511.  
  512.  
  513.  
  514. E) None of these
  515.  
  516. Save
  517.  
  518.  
  519. Question 17 (1 point)
  520. Question 17 Unsaved
  521.  
  522.  
  523.  
  524. Which statement correctly defines a vector object for holding integers?
  525.  
  526. Question 17 options:
  527.  
  528.  
  529.  
  530. A)
  531. vector <int> v;
  532.  
  533.  
  534.  
  535.  
  536. B)
  537. int vector v;
  538.  
  539.  
  540.  
  541.  
  542. C)
  543. vector v <int>;
  544.  
  545.  
  546.  
  547.  
  548. D)
  549. int <vector> v;
  550.  
  551.  
  552. Save
  553.  
  554.  
  555. Question 18 (1 point)
  556. Question 18 Unsaved
  557.  
  558.  
  559. What is the last legal subscript that can be used with the following array?
  560.  
  561. int values[5];
  562.  
  563. Question 18 options:
  564.  
  565.  
  566.  
  567. A) 5
  568.  
  569.  
  570.  
  571. B) 4
  572.  
  573.  
  574.  
  575. C) 6
  576.  
  577.  
  578.  
  579. D) 0
  580.  
  581. Save
  582.  
  583.  
  584. Question 19 (1 point)
  585. Question 19 Unsaved
  586.  
  587.  
  588. The statement:
  589.  
  590. int grades[ ] = { 100, 90, 99, 80};
  591.  
  592. shows an example of:
  593. Question 19 options:
  594.  
  595.  
  596.  
  597. A) implicit array sizing
  598.  
  599.  
  600.  
  601. B) default arguments
  602.  
  603.  
  604.  
  605. C) an illegal array declaration
  606.  
  607.  
  608.  
  609. D) an illegal array initialization
  610.  
  611.  
  612.  
  613. E) None of these
  614.  
  615. Save
  616.  
  617.  
  618. Question 20 (1 point)
  619. Question 20 Unsaved
  620.  
  621.  
  622.  
  623. What will the following C++ 11 code display?
  624.  
  625. vector<int> numbers { 3, 5 };
  626.  
  627. for (int val : numbers)
  628. cout << val << endl;
  629.  
  630.  
  631. Question 20 options:
  632.  
  633.  
  634.  
  635. A)
  636. 3
  637. 5
  638.  
  639.  
  640.  
  641.  
  642.  
  643. B)
  644. 5
  645. 5
  646. 5
  647.  
  648.  
  649.  
  650.  
  651.  
  652. C)
  653. 3
  654. 3
  655. 3
  656. 3
  657. 3
  658.  
  659.  
  660.  
  661.  
  662.  
  663. D)
  664. Nothing. This code has an error.
  665.  
  666.  
  667.  
  668. Question 21 (1 point)
  669. Question 21 Unsaved
  670.  
  671.  
  672. How many elements does the following array have?
  673.  
  674. int bugs[1000];
  675.  
  676. Question 21 options:
  677.  
  678.  
  679.  
  680. A) 999
  681.  
  682.  
  683.  
  684. B) 1001
  685.  
  686.  
  687.  
  688. C) 1000
  689.  
  690.  
  691.  
  692. D) Cannot tell from the code
  693.  
  694. Save
  695.  
  696.  
  697. Question 22 (1 point)
  698. Question 22 Unsaved
  699.  
  700.  
  701. Which of the following is a valid C++ array definition?
  702. Question 22 options:
  703.  
  704.  
  705.  
  706. A) float $payments[10];
  707.  
  708.  
  709.  
  710. B) void numbers[5];
  711.  
  712.  
  713.  
  714. C) int array[10];
  715.  
  716.  
  717.  
  718. D) int array[0];
  719.  
  720.  
  721.  
  722. E) None of these
  723.  
  724. Save
  725.  
  726.  
  727. Question 23 (1 point)
  728. Question 23 Unsaved
  729.  
  730.  
  731. It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].
  732. Question 23 options:
  733.  
  734.  
  735.  
  736. A) legal in C++
  737.  
  738.  
  739.  
  740. B) not good programming practice
  741.  
  742.  
  743.  
  744. C) illegal in C++
  745.  
  746.  
  747.  
  748. D) not recommended by the ANSI committee
  749.  
  750.  
  751.  
  752. E) None of these
  753.  
  754. Save
  755.  
  756.  
  757. Question 24 (1 point)
  758. Question 24 Unsaved
  759.  
  760.  
  761. To access an array element, use the array name and the element's ________.
  762. Question 24 options:
  763.  
  764.  
  765.  
  766. A) data type
  767.  
  768.  
  769.  
  770. B) name
  771.  
  772.  
  773.  
  774. C) subscript
  775.  
  776.  
  777.  
  778. D) value
  779.  
  780.  
  781.  
  782. E) None of these
  783.  
  784. Save
  785.  
  786.  
  787. Question 25 (1 point)
  788. Question 25 Unsaved
  789.  
  790.  
  791. By using the same ________ you can build relationships between data stored in two or more arrays.
  792. Question 25 options:
  793.  
  794.  
  795.  
  796. A) data
  797.  
  798.  
  799.  
  800. B) array name
  801.  
  802.  
  803.  
  804. C) arguments
  805.  
  806.  
  807.  
  808. D) subscript
  809.  
  810.  
  811.  
  812. E) None of these
  813.  
  814.  
  815. Question 26 (1 point)
  816. Question 26 Unsaved
  817.  
  818.  
  819. A two-dimensional array of characters can contain ________.
  820. Question 26 options:
  821.  
  822.  
  823.  
  824. A) strings of different lengths
  825.  
  826.  
  827.  
  828. B) uninitialized elements
  829.  
  830.  
  831.  
  832. C) strings of the same length
  833.  
  834.  
  835.  
  836. D) All of these
  837.  
  838.  
  839.  
  840. E) None of these
  841.  
  842. Save
  843.  
  844.  
  845. Question 27 (1 point)
  846. Question 27 Unsaved
  847.  
  848.  
  849. This vector function is used to insert an item into a vector.
  850. Question 27 options:
  851.  
  852.  
  853.  
  854. A) store
  855.  
  856.  
  857.  
  858. B) add_item
  859.  
  860.  
  861.  
  862. C) push_back
  863.  
  864.  
  865.  
  866. D) insert_item
  867.  
  868. Save
  869.  
  870.  
  871. Question 28 (1 point)
  872. Question 28 Unsaved
  873.  
  874.  
  875. What will the following code do?
  876.  
  877. const int SIZE = 5;
  878. double x[SIZE];
  879. for(int i = 2; i <= SIZE; i++)
  880. {
  881. x[i] = 0.0;
  882. }
  883.  
  884. Question 28 options:
  885.  
  886.  
  887.  
  888. A) Each element in the array, except the first, is initialized to 0.0
  889.  
  890.  
  891.  
  892. B) Each element in the array is initialized to 0.0
  893.  
  894.  
  895.  
  896. C) Each element in the array, except the first and the last, is initialized to 0.0
  897.  
  898.  
  899.  
  900. D) An error will occur when the code runs
  901.  
  902. Save
  903.  
  904.  
  905.  
  906.  
  907.  
  908. Question 29 (1 point)
  909. Question 29 Unsaved
  910.  
  911.  
  912. Array elements must be ________ before a binary search can be performed.
  913. Question 29 options:
  914.  
  915.  
  916.  
  917. A) sorted
  918.  
  919.  
  920.  
  921. B) positive numbers
  922.  
  923.  
  924.  
  925. C) set to zero
  926.  
  927.  
  928.  
  929. D) summed
  930.  
  931.  
  932.  
  933. E) None of these
  934.  
  935. Save
  936.  
  937.  
  938. Question 30 (1 point)
  939. Question 30 Unsaved
  940.  
  941.  
  942. A(n) ________ search is more efficient than a ________ search.
  943. Question 30 options:
  944.  
  945.  
  946.  
  947. A) integer, double
  948.  
  949.  
  950.  
  951. B) binary, linear
  952.  
  953.  
  954.  
  955. C) linear, binary
  956.  
  957.  
  958.  
  959. D) character, string
  960.  
  961.  
  962.  
  963. E) None of these
  964.  
  965.  
  966.  
  967. Question 31 (1 point)
  968. Question 31 Unsaved
  969.  
  970.  
  971. Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, ________ element(s) must be compared.
  972. Question 31 options:
  973.  
  974.  
  975.  
  976. A) only half
  977.  
  978.  
  979.  
  980. B) 20,000
  981.  
  982.  
  983.  
  984. C) 2000
  985.  
  986.  
  987.  
  988. D) only the first
  989.  
  990.  
  991.  
  992. E) None of these
  993.  
  994. Save
  995.  
  996.  
  997. Question 32 (1 point)
  998. Question 32 Unsaved
  999.  
  1000.  
  1001. The ________ is adequate for searching through small arrays.
  1002. Question 32 options:
  1003.  
  1004.  
  1005.  
  1006. A) linear search
  1007.  
  1008.  
  1009.  
  1010. B) unary search
  1011.  
  1012.  
  1013.  
  1014. C) bubble sort
  1015.  
  1016.  
  1017.  
  1018. D) binary search
  1019.  
  1020.  
  1021.  
  1022. E) None of these
  1023.  
  1024. Save
  1025.  
  1026.  
  1027. Question 33 (1 point)
  1028. Question 33 Unsaved
  1029.  
  1030.  
  1031. A binary search begins with the ________ element of an array.
  1032. Question 33 options:
  1033.  
  1034.  
  1035.  
  1036. A) last
  1037.  
  1038.  
  1039.  
  1040. B) middle
  1041.  
  1042.  
  1043.  
  1044. C) first
  1045.  
  1046.  
  1047.  
  1048. D) largest
  1049.  
  1050.  
  1051.  
  1052. E) None of these
  1053.  
  1054. Save
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. Question 34 (1 point)
  1061. Question 34 Unsaved
  1062.  
  1063.  
  1064. The following statement:
  1065.  
  1066. cin >> *num3;
  1067.  
  1068. Question 34 options:
  1069.  
  1070.  
  1071.  
  1072. A) is illegal in C++
  1073.  
  1074.  
  1075.  
  1076. B) stores the keyboard input into the pointer called num3
  1077.  
  1078.  
  1079.  
  1080. C) stores the keyboard input into the variable num3
  1081.  
  1082.  
  1083.  
  1084. D) stores the keyboard input into the variable pointed to by num3
  1085.  
  1086.  
  1087.  
  1088. E) None of these
  1089.  
  1090. Save
  1091.  
  1092.  
  1093. Question 35 (1 point)
  1094. Question 35 Unsaved
  1095.  
  1096.  
  1097. What will the following code output?
  1098.  
  1099. int number = 22;
  1100. int *var = &number;
  1101. cout << var << endl;
  1102.  
  1103. Question 35 options:
  1104.  
  1105.  
  1106.  
  1107. A) An asterisk followed by the address of the number variable
  1108.  
  1109.  
  1110.  
  1111. B) 22
  1112.  
  1113.  
  1114.  
  1115. C) An asterisk followed by 22
  1116.  
  1117.  
  1118.  
  1119. D) The address of the number variable
  1120.  
  1121.  
  1122. Question 36 (1 point)
  1123. Question 36 Unsaved
  1124.  
  1125.  
  1126. Look at the following statement:
  1127.  
  1128. sum += *array++;
  1129.  
  1130. This statement ________.
  1131. Question 36 options:
  1132.  
  1133.  
  1134.  
  1135. A) will always result in a compiler error
  1136.  
  1137.  
  1138.  
  1139. B) increments the dereferenced pointer's value by one, then assigns that value
  1140.  
  1141.  
  1142.  
  1143. C) assigns the dereferenced pointer's value, then increments the pointer's address
  1144.  
  1145.  
  1146.  
  1147. D) is illegal in C++
  1148.  
  1149.  
  1150.  
  1151. E) None of these
  1152.  
  1153. Save
  1154.  
  1155.  
  1156. Question 37 (1 point)
  1157. Question 37 Unsaved
  1158.  
  1159.  
  1160. If a variable uses more than one byte of memory, for pointer purposes its address is ________.
  1161. Question 37 options:
  1162.  
  1163.  
  1164.  
  1165. A) the address of the first byte of storage
  1166.  
  1167.  
  1168.  
  1169. B) general delivery
  1170.  
  1171.  
  1172.  
  1173. C) the average of the addresses used to store the variable
  1174.  
  1175.  
  1176.  
  1177. D) the address of the last byte of storage
  1178.  
  1179.  
  1180.  
  1181. E) None of these
  1182.  
  1183. Save
  1184.  
  1185.  
  1186. Question 38 (1 point)
  1187. Question 38 Unsaved
  1188.  
  1189.  
  1190. A function may return a pointer, but the programmer must ensure that the pointer ________.
  1191. Question 38 options:
  1192.  
  1193.  
  1194.  
  1195. A) has not been assigned an address
  1196.  
  1197.  
  1198.  
  1199. B) was received as a parameter by the function
  1200.  
  1201.  
  1202.  
  1203. C) still points to a valid object after the function ends
  1204.  
  1205.  
  1206.  
  1207. D) has not previously been returned by another function
  1208.  
  1209.  
  1210.  
  1211. E) None of these
  1212.  
  1213. Save
  1214.  
  1215.  
  1216. Question 39 (1 point)
  1217. Question 39 Unsaved
  1218.  
  1219.  
  1220. In C++ 11, the ________ key word was introduced to represent the address 0.
  1221. Question 39 options:
  1222.  
  1223.  
  1224.  
  1225. A) nullptr
  1226.  
  1227.  
  1228.  
  1229. B) weak_ptr
  1230.  
  1231.  
  1232.  
  1233. C) NULL
  1234.  
  1235.  
  1236.  
  1237. D) All of these
  1238.  
  1239.  
  1240.  
  1241. E) None of these
  1242.  
  1243. Save
  1244.  
  1245.  
  1246. Question 40 (1 point)
  1247. Question 40 Unsaved
  1248.  
  1249.  
  1250. The ________, also known as the address operator, returns the memory address of a variable.
  1251. Question 40 options:
  1252.  
  1253.  
  1254.  
  1255. A) asterisk ( * )
  1256.  
  1257.  
  1258.  
  1259. B) exclamation point ( ! )
  1260.  
  1261.  
  1262.  
  1263. C) percent sign (%)
  1264.  
  1265.  
  1266.  
  1267. D) ampersand ( & )
  1268.  
  1269.  
  1270.  
  1271. E) None of these
  1272.  
  1273.  
  1274.  
  1275. Question 41 (1 point)
  1276. Question 41 Unsaved
  1277.  
  1278.  
  1279. What will the following code output?
  1280.  
  1281. int number = 22;
  1282. int *var = &number;
  1283. cout << *var << endl;
  1284.  
  1285. Question 41 options:
  1286.  
  1287.  
  1288.  
  1289. A) An asterisk followed by 22
  1290.  
  1291.  
  1292.  
  1293. B) 22
  1294.  
  1295.  
  1296.  
  1297. C) The address of the number variable
  1298.  
  1299.  
  1300.  
  1301. D) An asterisk followed by the address of the number variable
  1302.  
  1303. Save
  1304.  
  1305.  
  1306. Question 42 (1 point)
  1307. Question 42 Unsaved
  1308.  
  1309.  
  1310. A pointer variable may be initialized with ________.
  1311. Question 42 options:
  1312.  
  1313.  
  1314.  
  1315. A) any non-zero integer value
  1316.  
  1317.  
  1318.  
  1319. B) a valid address in the computer's memory
  1320.  
  1321.  
  1322.  
  1323. C) an address less than 0
  1324.  
  1325.  
  1326.  
  1327. D) A and C only
  1328.  
  1329.  
  1330.  
  1331. E) None of these
  1332.  
  1333. Save
  1334.  
  1335.  
  1336. Question 43 (1 point)
  1337. Question 43 Unsaved
  1338.  
  1339.  
  1340. ________ can be used as pointers.
  1341. Question 43 options:
  1342.  
  1343.  
  1344.  
  1345. A) Numeric constants
  1346.  
  1347.  
  1348.  
  1349. B) Punctuation marks
  1350.  
  1351.  
  1352.  
  1353. C) Array names
  1354.  
  1355.  
  1356.  
  1357. D) All of these
  1358.  
  1359.  
  1360.  
  1361. E) None of these
  1362.  
  1363. Save
  1364.  
  1365.  
  1366. Question 44 (1 point)
  1367. Question 44 Unsaved
  1368.  
  1369.  
  1370. Which of the following statements is not valid C++ code?
  1371. Question 44 options:
  1372.  
  1373.  
  1374.  
  1375. A) float num1 = &ptr2;
  1376.  
  1377.  
  1378.  
  1379. B) int ptr = int *num1;
  1380.  
  1381.  
  1382.  
  1383. C) int ptr = &num1;
  1384.  
  1385.  
  1386.  
  1387. D) All of these are valid.
  1388.  
  1389.  
  1390.  
  1391. E) All of these are invalid.
  1392.  
  1393. Save
  1394.  
  1395.  
  1396. Question 45 (1 point)
  1397. Question 45 Unsaved
  1398.  
  1399.  
  1400. When the less than ( < ) operator is used between two pointer variables, the expression is testing whether ________.
  1401. Question 45 options:
  1402.  
  1403.  
  1404.  
  1405. A) the value pointed to by the first is greater than the value pointed to by the second
  1406.  
  1407.  
  1408.  
  1409. B) the first variable was declared before the second variable
  1410.  
  1411.  
  1412.  
  1413. C) the address of the first variable comes before the address of the second variable in the computer's memory
  1414.  
  1415.  
  1416.  
  1417. D) the value pointed to by the first is less than the value pointed to by the second
  1418.  
  1419.  
  1420.  
  1421. E) None of these
  1422.  
  1423.  
  1424.  
  1425. Question 46 (1 point)
  1426. Question 46 Unsaved
  1427.  
  1428.  
  1429. Use the delete operator only on pointers that were ________.
  1430. Question 46 options:
  1431.  
  1432.  
  1433.  
  1434. A) not correctly initialized
  1435.  
  1436.  
  1437.  
  1438. B) dereferenced inappropriately
  1439.  
  1440.  
  1441.  
  1442. C) never used
  1443.  
  1444.  
  1445.  
  1446. D) created with the new operator
  1447.  
  1448.  
  1449.  
  1450. E) None of these
  1451.  
  1452. Save
  1453.  
  1454.  
  1455. Question 47 (1 point)
  1456. Question 47 Unsaved
  1457.  
  1458.  
  1459. Which statement displays the address of the variable num1?
  1460. Question 47 options:
  1461.  
  1462.  
  1463.  
  1464. A) cin >> &num1;
  1465.  
  1466.  
  1467.  
  1468. B) cout << &num1;
  1469.  
  1470.  
  1471.  
  1472. C) cout << num1;
  1473.  
  1474.  
  1475.  
  1476. D) cout << *num1;
  1477.  
  1478.  
  1479.  
  1480. E) None of these
  1481.  
  1482. Save
  1483.  
  1484.  
  1485. Question 48 (1 point)
  1486. Question 48 Unsaved
  1487.  
  1488.  
  1489. Assuming ptr is a pointer variable, what will the following statement output?
  1490.  
  1491. cout << *ptr;
  1492.  
  1493. Question 48 options:
  1494.  
  1495.  
  1496.  
  1497. A) The address of the variable stored in ptr.
  1498.  
  1499.  
  1500.  
  1501. B) The string "*ptr".
  1502.  
  1503.  
  1504.  
  1505. C) The value stored in the variable whose address is contained in ptr.
  1506.  
  1507.  
  1508.  
  1509. D) The address of the variable whose address is stored in ptr.
  1510.  
  1511.  
  1512.  
  1513. E) None of these
  1514.  
  1515. Save
  1516.  
  1517.  
  1518. Question 49 (1 point)
  1519. Question 49 Unsaved
  1520.  
  1521.  
  1522. If you are using an older compiler that does not support the C++ 11 standard, you should initialize pointers with ________.
  1523. Question 49 options:
  1524.  
  1525.  
  1526.  
  1527. A) the integer 0, or the value NULL
  1528.  
  1529.  
  1530.  
  1531. B) a nonzero value
  1532.  
  1533.  
  1534.  
  1535. C) the null terminator '\0'
  1536.  
  1537.  
  1538.  
  1539. D) All of these
  1540.  
  1541.  
  1542.  
  1543. E) None of these
  1544.  
  1545. Save
  1546.  
  1547.  
  1548. Question 50 (1 point)
  1549. Question 50 Unsaved
  1550.  
  1551.  
  1552. When you pass a pointer as an argument to a function, you must ________.
  1553. Question 50 options:
  1554.  
  1555.  
  1556.  
  1557. A) dereference the pointer variable in the function prototype
  1558.  
  1559.  
  1560.  
  1561. B) declare the pointer variable again in the function call
  1562.  
  1563.  
  1564.  
  1565. C) not dereference the pointer in the function's body
  1566.  
  1567.  
  1568.  
  1569. D) use the #include statement
  1570.  
  1571.  
  1572.  
  1573. E) None of these
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement