A binary search function receives an array of integers to be searched. The formal parameter for the array is coded as int* list. Which of the following statements properly determines the next mid point to be tested when first and last are pointer variables and mid is an index?
A. mid = first + last - first / 2;
B. mid = (first * last - first) / 2;
C. mid = first + (last - first) / 2;
D. mid = *first + *last - *first / 2;
E. mid = *first + (*last - *first) / 2;
Answer: C
You might also like to view...
Which of the following statements is false?
A. Photoshop allows you to transfer images from CDs, DVDs, digital cameras, and scanners. B. Photoshop has many sophisticated color tools that allow you to enhance the appearance of photographs. C. Photoshop is perfect for working with color photographs, but black-and-white photographs pose several problems and require plug-ins. D. Photoshop can automatically process a batch of files for one type of output, such as professional printing, and then reprocess the same batch of files by reducing their physical size and file size, and changing their format for use on the web.
Critical Thinking QuestionsCase 10-2Melissa helps you figure out how to use the OleDbDataAdapter to make a connection to a database for you. But in order to help you learn as much as you can, she wants you to begin to figure out things on your own.Which of the following is NOT a true statement Melissa can make to you about filling the DataTable object you have created?
a. As soon as you connect to the database and fill the DataTable object, the next statement should disconnect the application from the database.c. After the DataTable is initialized, it must be filled using the Populate command with the data from the selected table.b. To keep the maximum number of connections available, you should keep connections open only as long as necessary.d. By using the database in disconnected form, the system resources of the computer and network are not overloaded. What will be an ideal response?
What piece of software tells the operating system how to use a specific hardware device?
A. graphical user interface B. system service C. device driver D. user interface
Which of the following is replayed during wireless authentication to exploit a weak key infrastructure?
A. Preshared keys B. Ticket exchange C. Initialization vectors D. Certificate exchange