Question Hot Seat - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Question Hot Seat

Description:

Question Hot Seat. public MyConstructor (int a, int b) { index = a b; Parameters. Class Name ... Please put match these choices to these boxes from left to ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 34
Provided by: Sta4
Category:
Tags: hot | question | seat

less

Transcript and Presenter's Notes

Title: Question Hot Seat


1
Question Hot Seat
public MyConstructor (int a, int b)
index ab
  1. Parameters
  2. Class Name
  3. Body
  4. Modifier

DBAC
Please put match these choices to these boxes
from left to right
2
1000
Ask Audience 50-50 Call a friend
500
300
200
100
Which of the following is invalid identifier?
a. GoodVar
b. Good123Var
c. Good_123Var
d. GoodVar
3
1000
Ask Audience 50-50 Call a friend
500
300
200
100
How would you define a Java array?
a. GoodVar
b. Good123Var
a. Good_123Var
a. GoodVar
4
1000
Ask Audience 50-50 Call a friend
500
300
200
100
How would you define a Java array?
a. a collection of data values of different types
b. a collection of data values of the same type
c. a collection of characters that incidentally
form a string
d. a collection of primitive data types
5
1000
Ask Audience 50-50 Call a friend
500
300
200
100
How would you define a Java array?
a. a collection of data values of different types
b. a collection of data values of the same type
c. a collection of characters that incidentally
form a string
d. a collection of primitive data types
6
1000
Ask Audience 50-50 Call a friend
500
300
200
100
What are the two ways that a Java array can be
declared?
a. lttypegt ltarraynamegt lttypegt ltarraynamegt
b. lttypegt ltarraynamegt lttypegt ltarraynamegt

c. lttypegt ltarraynamegtlttypegt ltarraynamegt
d. lttypegt ltarraynamegtlttypegt ltarraynamegt
7
1000
Ask Audience 50-50 Call a friend
500
300
200
100
What are the two ways that a Java array can be
declared?
a. lttypegt ltarraynamegt lttypegt ltarraynamegt
b. lttypegt ltarraynamegt lttypegt ltarraynamegt

c. lttypegt ltarraynamegtlttypegt ltarraynamegt
d. lttypegt ltarraynamegtlttypegt ltarraynamegt
8
1000
Ask Audience 50-50 Call a friend
500
300
200
100
Which of the following declares an array of
integers of size 20?
a. int a int20
b. int a new int20
c. int a new int19
d. int a new int19
9
1000
Ask Audience 50-50 Call a friend
500
300
200
100
Which of the following declares an array of
integers of size 20?
a. int a int20
b. int a new int20
c. int a new int19
d. int a new int19
10
1000
Ask Audience 50-50 Call a friend
500
300
200
100
How would we access the 12th element of the
array, x?
a. x(12)
b. x(11)
c. x12
d. x11
11
1000
Ask Audience 50-50 Call a friend
500
300
200
100
How would we access the 12th element of the
array, x?
a. x(12)
b. x(11)
c. x12
d. x11
12
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
Why are loops particularly useful for array
operations?
a. Because loops easily traverse through the
indexes of the array.
b. Because loops solve problems that otherwise
would not be solvable without them.
c. Because loops take less time to run than
conventional coding without loops.
d. Loops do not aid in the processing of arrays.
13
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
Why are loops particularly useful for array
operations?
a. Because loops easily traverse through the
indexes of the array.
b. Because loops solve problems that otherwise
would not be solvable without them.
c. Because loops take less time to run than
conventional coding without loops.
d. Loops do not aid in the processing of arrays.
14
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
What does the following program do?double x
0, unknownfor (int j 0 j lt
someArray.length j) xsomeArrayjunkn
own x /someArray.length
a. Computes the sum of the doubles in the array,
someArray.
b. Deletes all the doubles in the array,
someArray.
c. Computes the average of all the doubles in the
array, someArray
d. Computes the dot product of all the doubles in
the array, someArray.
15
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
What does the following program do?double x
0, unknownfor (int j 0 j lt
someArray.length j) xsomeArrayjunkn
own x /someArray.length
a. Computes the sum of the doubles in the array,
someArray.
b. Deletes all the doubles in the array,
someArray.
c. Computes the average of all the doubles in the
array, someArray
d. Computes the dot product of all the doubles in
the array, someArray.
16
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
Given a value X, return the index of X in the
array, if such X exists. Otherwise, return
NOT_FOUND. We assume there are no duplicate
entries in the array.What are the two possible
outcomes in this problem?
a. linear search and binary search
b. -1 and X
d. successful and unsuccessful
c. an index and a value
17
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
Given a value X, return the index of X in the
array, if such X exists. Otherwise, return
NOT_FOUND. We assume there are no duplicate
entries in the array.What are the two possible
outcomes in this problem?
a. linear search and binary search
b. -1 and X
d. successful and unsuccessful
c. an index and a value
18
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
When would a programmer be forced to pick a
linear search over a binary search?
a. When the items in the array are in ascending
order
b. When the items in the array are in descending
order
d. Linear search is never a better choice than
binary search.
c. When the items in the array are unsorted
19
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
When would a programmer be forced to pick a
linear search over a binary search?
a. When the items in the array are in ascending
order
b. When the items in the array are in descending
order
d. Linear search is never a better choice than
binary search.
c. When the items in the array are unsorted
20
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
Which of the following best describes the
protocol for a selection sort?
  • Identify the largest element.Place the element
    at the beginning of a target listRepeat

b. Identify the median of the listSplit the list
into two halves, those smaller and those larger
than the medianPerform the same sort on each of
the smaller halves
c. Identify the smallest element of the
listPlace the element in the beginning of the
target list Repeat
d. Identify the median element of the listPlace
the element in the beginning of a target list
Repeat
21
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
Which of the following best describes the
protocol for a selection sort?
  • Identify the largest element.Place the element
    at the beginning of a target listRepeat

b. Identify the median of the listSplit the list
into two halves, those smaller and those larger
than the medianPerform the same sort on each of
the smaller halves
c. Identify the smallest element of the
listPlace the element in the beginning of the
target list Repeat
d. Identify the median element of the listPlace
the element in the beginning of a target list
Repeat
22
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
What is the biggest number of computations made
for a binary search on a sorted array of size 64?
a) 3
b) 5
c) 6
d) 8
23
32000
Ask Audience 50-50 Call a friend
16000
8000
4000
2000
What is the biggest number of computations made
for a binary search on a sorted array of size 64?
a) 3
b) 5
c) 6
d) 8
24
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
What is wrong with the following code?int
product 0, count0while (product lt 2500)
product 5 count
a. the syntax of the while statement is invalid
b. the operator, , does not exist.
c. it has an infinite loop
d. the count variable is initialized incorrectly.
25
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
What is wrong with the following code?int
product 0, count0while (product lt 2500)
product 5 count
a. the syntax of the while statement is invalid
b. the operator, , does not exist.
c. it has an infinite loop
d. the count variable is initialized incorrectly.
26
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
Assume you had a class BankInfo that contained
three data members accountNumber, pinNumber,
and name. The data member name must be
searchable by other classes.What access
modifiers would you apply to these members?
b. make accountNumber public, pinNumber private,
and name public
a. make accountNumber private, pinNumber
private, and name public
c. make them all private
d. make them all public
27
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
Assume you had a class BankInfo that contained
three data members accountNumber, pinNumber,
and name. The data member name must be
searchable by other classes.What access
modifiers would you apply to these members?
b. make accountNumber public, pinNumber private,
and name public
a. make accountNumber private, pinNumber
private, and name public
c. make them all private
d. make them all public
28
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
What is the difference in path name specification
between the UNIX and Windows operating systems?
b. UNIX allows for spaces in file and directory
names while Windows does not.
a. There are no .exe files in UNIX but there are
.exe files in Windows
c. UNIX separates directories from
subdirectories with forward slashes while Windows
separates directories with backslashes.
d. There is no difference
29
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
What is the difference in path name specification
between the UNIX and Windows operating systems?
b. UNIX allows for spaces in file and directory
names while Windows does not.
a. There are no .exe files in UNIX but there are
.exe files in Windows
c. UNIX separates directories from
subdirectories with forward slashes while Windows
separates directories with backslashes.
d. There is no difference
30
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
Assume you want to read the contents of a file
and display to the monitor. Which file I/O
classes can we use to accomplish this?
b. FileInputStream or DataInputStream
a. FileInputStream or FileOutputStream
c. FileOutputStream or DataOutputStream
d. DataInputStream or DataOutputStream
31
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
Assume you want to read the contents of a file
and display to the monitor. Which file I/O
classes can we use to accomplish this?
b. FileInputStream or DataInputStream
a. FileInputStream or FileOutputStream
c. FileOutputStream or DataOutputStream
d. DataInputStream or DataOutputStream
32
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
33
1000000
Ask Audience 50-50 Call a friend
500000
250000
125000
64000
Write a Comment
User Comments (0)
About PowerShow.com