31. If the following values were inserted into a binary tree sequentially, 92, 8
ID: 3681331 • Letter: 3
Question
31. If the following values were inserted into a binary tree sequentially, 92, 88, 51, 55, 36, 69, 37, 97, 56, 49, what would be the fifth value in a preorder traversal? : * A. 55 B. 36 C. 51 D. 37 E. 69 32. In C++, which of the following is a valid type cast?: * A. to(char, a); B. c(char); C. (char):c D. char:c; E. (char)c 33. In C++, what is the return type of a function with prototype int func(char c, int k, float x, double amt); : * A. char B. byte C. int D. float E. double 34. In C++, which of the following indicates an array of two dimensions?: * A. union xUnion[20][20]; B. int xUnion[20][20]; C. int union[20][20]; D. int xUnion[20,20]; E. char union[20]; 35. In C++, what value must a destructor return?: * A. A pointer to the class B. A pointer to the parent of the class C. An object of the class D. A status code determining whether the class was destructed correctly E. Destructors do not return a value 36. In C++, if the address of amount has been assigned to the pointer ptr, which statement will display the value stored in amount?: *A. Choice A B. Choice B C. Choice C D. Choice D E. Choice E 37. Consider the following code below. For which of the following values of x will xValid return true?: *
A. 2 B. 8 C. 18 D. 28 E. 128 38. Consider the following code below. What would be the result?: *
A. An array index out of bounds error B. -5 C. 0 D. 5 E. A compilation error 39. You are designing an application for a school and are given the following specifications:
• For a given person, we must have methods to get the name, sex, and address of the person.
• A student is a type of person and we can look up the student's name, sex, and address via a student directory.
• A teacher is a type of person and we can look up the teacher's name, sex, and address via the faculty directory.
Which of the following code snippets represents well-written code and the best design for this problem (assume //code here represents valid code)?: * A.
public class Person
{ String getName(); String getSex(); String getAddress(); }
public class Student extends Person
{ public String getName() { //code here } public String getSex() { //code here } public String getAddress() { //code here }
public class Teacher extends Person
{ public String getName() { //code here } public String getSex() { //code here } public String getAddress() { //code here } B.
public interface Person
{ String getName(); String getSex(); String getAddress(); }
public class Student implements Person
{ public String getName() { //code here } public String getSex() { //code here } public String getAddress() { //code here }
public class Teacher implements Person
{ public String getName() { //code here } public String getSex() { //code here } public String getAddress() { //code here } C.
public interface Person
{ String getName(); String getSex(); String getAddress(); }
public class Student implements Person
{ String getName(); String getSex(); String getAddress(); }
public class Teacher implements Person
{ String getName(); String getSex(); String getAddress(); } D.
public abstract class Person
{ String getName(); String getSex(); String getAddress(); }
public class Student implements Person
{ String getName(); String getSex(); String getAddress(); }
public class Teacher implements Person
{ String getName(); String getSex(); String getAddress(); } E. Both C and D would work. 40. Which of the following situations will cause the longest execution time of a sequential search looking for a particular value in an array of 10 integers?: * A. The value is at position 3 in the array B. The value is at position 6 in the array C. The value is at position 9 in the array D. The value is in the middle of the array E. The value is not in the array 41. Under which of these conditions is it appropriate to overload a method: * A. When the methods are coded to perform different tasks B. When the methods have different parameter names C. When the methods have different parameter data types D. When the methods have different post- and/or pre-conditions E. Two methods with the same name will cause a compilation error 42. Which of the following statements assigns the letter Q to the fourth row and second column of a two-dimensional array named alphaChart, using the convention associated with mathematical matrices?: * A. alphaChart.setValue(3, 1, "Q"); B. alphaChart[3][1] = "Q"; C. alphaChart[1][3] = "Q"; D. alphaChart[4][2] = "Q"; E. alphaChart[2][4] = "Q"; 43. What is the decimal (base 10) representation of the unsigned binary number 01001100?: * A. 76 B. 44 C. 114 D. 72 E. 54 44. Which of the following statements allows a program to walk through a collection and remove elements from the collection.: * A. Set B. Queue C. Iterator D. List E. Tree 45. Which JAVA regular expression finds the words “hello” or “world”: * A. (hello|world) B. [helloworld] C. (hello&world) D. (hello^world) E. [hello&world] 46. Which of the following statements is TRUE?: * A. Both syntax errors and logic errors are caught by the compiler B. Both syntax errors and logic errors have effects at run time C. Syntax errors are caught by the compiler. Logic errors may have effects at run time. D. Logic errors are caught by the compiler. Syntax errors may have effects at run time. E. An InputMismatchException is indicative of a syntax error 47. In C++, what does the following function call return?
strcmp(“Kyle”, “King”)
: * A. a value < 0 B. 0 C. a value > 0 D. This will generate a runtime error. E. This will generate a compilation error. 48. In C++, a do…while loop is considered to be a: * A. pretest loop B. posttest loop C. infinite loop D. top-driven loop E. selection loop 49. Which of the following statements is TRUE given the code below?: *
A. The code will not compile because of the multiple declarations of scopeVariable. B. The code will not compile because in the class bar it should be myFoo.scope1() instead of foo.scope1(). C. If callScope1 is called correctly, the scopeVariable member of myFoo will be updated to have the value of 1. D. If callScope1 is called correctly, the scopeVariable member of myFoo will still be 0. E. If callScope1 is called correctly, a run time error will be generated. 50. Consider the following code below. What would be the result?: *
A. A divide by zero run-time error. B. 100 C. -100 D. 1 E. A compilation error
Explanation / Answer
32) b
33) c
34) c
35) e
36) d
37)
38) e
39) a
40) e
41) c
42) d
43) a
44) c
45) a
46) a
47) c
48) a
49)
50) c
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.