EBK C   PROGRAMMING:
EBK C PROGRAMMING:
8th Edition
ISBN: 9780357156025
Author: Malik
Publisher: Cengage Learning
Question
100%
Book Icon
Chapter 16, Problem 1TF

a.

Program Plan Intro

To find whether a list is a collection of elements of the same type or not.

a.

Expert Solution
Check Mark
Program Description Answer

True.

Explanation of Solution

Explanation:

A list is a collection of elements that are of the same type. The elements of the list can be stored in a one-dimensional array. The size of the list can be described with the help of the number of elements that it can store.

Conclusion:

Therefore, the given statement is true.

b.

Program Plan Intro

To find whether the sequential search of the elements in a list assumes that the elements are sorted or not.

b.

Expert Solution
Check Mark
Program Description Answer

False.

Explanation of Solution

Explanation:

In a sequential search, the desired element is searched sequentially. The element is compared from the first element in the list to the last element in the list until the desired element is found in the list. The sequential search does not assume that the list is sorted in any order.

Conclusion:

Therefore, the given statement is false.

c.

Program Plan Intro

To find whether the given statement is true or not.

For a list of 100 elements, whether the number of key comparisons is 5050 or not.

c.

Expert Solution
Check Mark
Program Description Answer

False.

Explanation of Solution

Explanation:

The bubble sort is a sorting technique that sorts the list of elements by comparing them to each other. The first element is compared to the next element and sorted if required. Then, it is compared to the next element and so on until it is placed in its proper place. This process is repeated until the entire list is sorted.

The key comparisons in bubble sort are calculated using the formula:

  nn1/2

where n is the number of elements in the list.

Here, n =100

Number of key comparisons =100 1001/2 

  = 9900/2 = 4950

Conclusion:

Therefore, as per the above calculation, the given number of comparisons are not correct. Hence, the given statement is false.

d.

Program Plan Intro

To find whether the binary search of the elements in a list assumes that the elements are sorted or not.

d.

Expert Solution
Check Mark
Program Description Answer

True.

Explanation of Solution

Explanation:

The binary search technique is a searching technique in which the middle element of the list is calculated. Then the middle element is compared with the element that needs to be searched from the list. If it matches then the search is successful otherwise another list is chosen and again the middle element is calculated. This process is repeated until the desired element is not found in the list.

The elements in binary search are sorted in a certain order. The order may be ascending or descending. The binary search on a list assumes that the list of elements is sorted.

Conclusion:

Therefore, the given statement is true.

e.

Program Plan Intro

To find whether the binary search is faster on the ordered list and slower on the unordered list of elements is true or not.

e.

Expert Solution
Check Mark
Program Description Answer

False.

Explanation of Solution

Explanation:

The elements in binary search are sorted in a certain order. The order may be ascending or descending. The only necessary condition to search an element in the given list using the binary search technique is that the list must be sorted.

The binary search applies to an ordered list of elements. The search operation is performed using the binary search technique if the list is ordered. It cannot be applied to the unordered list of elements.

Conclusion:

Therefore, the given statement is false.

f.

Program Plan Intro

To find whether the given statement “a binary search is faster on larger lists and a sequential search is faster on smaller lists” is correct or not.

f.

Expert Solution
Check Mark
Program Description Answer

True.

Explanation of Solution

Explanation:

The binary search is performed on a sorted list of elements. Whenever the medium of the list is calculated half of the list is rejected based on the elements that need to be searched in the list. It shortens the list in every step. So, it is faster on larger lists.

While the sequential search is performed on unsorted lists. The element is searched till the end of the list. It increases the execution time of the sequential search. So, it is more suitable for the smaller lists.

Conclusion:

Therefore, the given statement is true.

g.

Program Plan Intro

To find whether a vector object declared with 10 elements can store 10 elements or not.

g.

Expert Solution
Check Mark
Program Description Answer

False.

Explanation of Solution

Explanation:

A list is implemented using the vector type. It is implemented in the same as the array is implemented. The only difference is that the size of the vector can increase during the time of execution. If the vector object of size 10 is declared, it can shrink or expand to store more or fewer elements than 10.

Conclusion:

Therefore, the given statement is false.

h.

Program Plan Intro

To find whether the given statement “the expression vecList.capacity() returns the number of elements that can be added to the vecList” is correct or not.

h.

Expert Solution
Check Mark
Program Description Answer

True.

Explanation of Solution

Explanation:

The vector class contains many operations that can be performed on the vector object. The vecList.capacity() is the operation that returns the number of elements that can be added to the vecList.

Conclusion:

Therefore, the given statement is true.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
This battle room is focused on entry level tasks for a network analyst where you will be given trials and reconnaissance, sensor tuning, log aggregation, SIEM queries, and network analysis.   For this week’s project, complete the following tasks:   From your Project Ares portal, LOG IN Click on LAUNCH GAME. Select the region NORTH AMERICA Click on Battle School Under the BATTLE SCHOOL pop-up window, click on START TRAINING. Under the BATTLE ROOMS tile, click on ENTER. Under the NETWORK ANALYST tile, click on PLAY. Wait for the Battle Room to load. While loading, the BATTLE ROOM button will display red. Once the Battle Room is loaded, the BATTLE ROOM button will turn yellow and the center of the disk display will indicate CONNECTED. Click on the BATTLE ROOM button to enter the Battle Room. Below the TASKS folder, make sure you click on INSTRUCTIONS to download the Network Analyst Fundamentals material. In the Battle Room, under the TASKS menu select task INTRUSION DETECTION. Complete…
Create a relationship between the common field (Technician Number) of the two tables. Make sure that each client must have 1 and only 1 technician assigned, and each technician can have multiple clients. 2. Create a query to show the Client Number, Client Name, Billed, Paid for clients in Anderson city. Save the query. 3. Create a query to show the Technician Number, Last Name, First Name, YTD Earnings for technicians whose Hourly Rate is greater than or equal to 30. Save the query. 4. Create a query to show Client Number, Client Name, Billed, Paid for clients whose technician number is 22 and whose Billed is over 300. Save the query. 5. Create a query to show the Technician Number, Last Name, First Name, Client Number, Client Name for clients whose technician number 23. Save the query. 6. Create a query to show the Technician Number, Last Name, First Name, Client Number, Client Name for clients whose technician number 23 or 29. Save the query Help please Microsoft office access
Dijkstra's Algorithm (part 1).  Consider the network shown below, and Dijkstra’s link-state algorithm. Here, we are interested in computing the least cost path from node E (note: the start node here is E) to all other nodes using Dijkstra's algorithm. Using the algorithm statement used in the textbook and its visual representation, complete the "Step 0" row in the table below showing the link state algorithm’s execution by matching the table entries (i), (ii), (iii), and (iv) with their values.  Write down your final [correct] answer, as you‘ll need it for the next question.
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr