C++ PROGRAMMING LMS MINDTAP
C++ PROGRAMMING LMS MINDTAP
8th Edition
ISBN: 9781337696173
Author: Malik
Publisher: Cengage Learning
bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 1TF

Mark the following statements as true or false.

  1. A double type is an example of a simple data type. (1)

  2. A one-dimensional array is an example of a structured data type. (1)

  3. The size of an array is determined at compile time. (1,6)

  4. Given the declaration:

    int list[10];

    the statement:

    list[5] - list[3] * list[2];

    updates the content of the fifth component of the array list. (2)

  5. If an array index goes out of bounds, the program always terminates in an error. (3)

  6. The only aggregate operations allowable on int arrays are the increment and decrement operations. (5)

  7. Arrays can be passed as parameters to a function either by value or by reference. (6)

  8. A function can return a value of type array. (6)

  9. In C++, some aggregate operations are allowed for strings. (11,12,13)

  10. The declaration:

    char name [16] = "John K. Miller";

    declares name to be an array of 15 characters because the string "John K. Miller" has only 14 characters. (11)

  11. The declaration:

    char str = "Sunny Day";

    declares str to be a string of an unspecified length. (11)

    As parameters, two-dimensional arrays are passed either by value or by reference. (15,16)

a.

A double type is a simple data type. Hence, the given statement is “True”.

Expert Solution
Check Mark
Program Plan Intro

A data type is called simple if variables of that type can store only one valueat a time. In contrast, in a structured data type, each data item is a collection of otherdata items. Simple data types are building blocks of structured data types.

Program Description Answer

A double type is a simple data type. Hence, the given statement is “True”.

Explanation of Solution

Since a double type can store a single value at a time it is a simple data type.

b.

One-dimensional array is an example of a structured data type. Hence, the given statement is “True”.

Expert Solution
Check Mark
Program Plan Intro

A data type is called simple if variables of that type can store only one valueat a time. In contrast, in a structured data type, each data item is a collection of otherdata items. Simple data types are building blocks of structured data types.

Program Description Answer

One-dimensional array is an example of a structured data type. Hence, the given statement is “True”.

Explanation of Solution

One-dimensional array is an example of a structured data type, as it can store a collection of other data items.

c.

The size of an array is determined at compile time. Hence, the given statement is “True”.

Expert Solution
Check Mark
Program Plan Intro

An array is a collection of a fixed number of components (also called elements)all of the same data type and in contiguous (that is, adjacent) memory space.

Program Description Answer

The size of an array is determined at compile time. Hence, the given statement is “True”.

Explanation of Solution

An array is a collection of a fixed number of components hence the size of an array is determined at compile time.

d.

The statement does not update the fifth component. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

In C++[ ] is an operator called the array subscripting operator and the array index starts at 0.

Program Description Answer

The statement does not update the fifth component. Hence, the given statement is “False”.

Explanation of Solution

The statement updates the sixth component of the array list as the subscript begins with 0.

e.

If an array index goes out of bounds, the program does not necessarily terminatein an error. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

C++ does not check whether the index value is within range. If the index goes out of bounds and the program tries toaccess the component specified by the index, then whatever memory location is indicatedby the index that location is accessed. This can result in altering or accessingthe data of a memory location that was never intended to be modified or accessed. It can also lead to accessing a protected memory that causes the program to instantly halt. Hence, several unknown things can happen if the index goes out of bounds during execution.

Program Description Answer

If an array index goes out of bounds, the program does not necessarily terminatein an error. Hence, the given statement is “False”.

Explanation of Solution

If the index goes out of bounds and the program tries to access the component specified by the index, then whatever memory location is indicated by the index that location is accessed. This may or may not cause the program to instantly halt or terminate in an error.

f.

C++ does not allow aggregateoperations on an array. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

An aggregate operation on an array is any operation thatmanipulates the entire array as a single unit.

Program Description Answer

C++ does not allow aggregateoperations on an array. Hence, the given statement is “False”.

Explanation of Solution

C++ does not allow aggregate operations on an array.

g.

Arrays can be passed as parameters to a function never by value but only by reference. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

In C++, arrays are passed by reference only. Because arrays are passed by reference only, the &symbol is never used when declaringan array as a formal parameter.

Program Description Answer

Arrays can be passed as parameters to a function never by value but only by reference. Hence, the given statement is “False”.

Explanation of Solution

In C++, arrays are passed by reference only and never by value.

h.

A function cannot return a value of type array. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

A function cannot return a value of type array.

Program Description Answer

A function cannot return a value of type array. Hence, the given statement is “False”.

Explanation of Solution

A function cannot return a value of type array.

i.

In C++, some aggregate operations are allowed for strings. Hence, the given statement is “True”.

Expert Solution
Check Mark
Program Plan Intro

Most rules that apply to arrays apply to C-strings as well. Aggregateoperations, such as assignment and comparison, are not allowed on arrays. Also the input/output of arrays is done component-wise. But, C++ allows aggregate operations of the input and output on C-strings which are nothing but character arrays terminated with the null character.

Program Description Answer

In C++, some aggregate operations are allowed for strings. Hence, the given statement is “True”.

Explanation of Solution

C++ allows aggregate operations of the input and output on C-strings which are nothing but character arrays.

j.

The name array is of size 16 and not 15. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

The name array is of size 16 which is mentioned in the declaration of the variable and not the size of string stored into it. There remains 1 unused component in the name array.

Program Description Answer

The name array is of size 16 and not 15. Hence, the given statement is “False”.

Explanation of Solution

The name array is of size 16 which is mentioned in the declaration of the variable and not the size of string stored into it. There remains 1 unused component in the name array.

k.

Aggregate operation such as assignment is not allowed on arrays and the statement is illegal. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

Aggregate operation such as assignment is not allowed on arrays and the statement is illegal. For assignment operation on c-strings (char arrays) c-string functions are needed.

Program Description Answer

Aggregate operation such as assignment is not allowed on arrays and the statement is illegal. Hence, the given statement is “False”.

Explanation of Solution

Aggregate operation such as assignment is not allowed on arrays and the statement is illegal. For assignment operation on c-strings (char arrays) c-string functions are needed.

l.

Two-dimensional arrays can be passed as parameters to a function, and they arepassed by reference only. Hence, the given statement is “False”.

Expert Solution
Check Mark
Program Plan Intro

Two-dimensional arrays can be passed as parameters to a function, and they arepassed by reference.

Program Description Answer

Two-dimensional arrays can be passed as parameters to a function, and they arepassed by reference only. Hence, the given statement is “False”.

Explanation of Solution

Two-dimensional arrays can be passed as parameters to a function, and they arepassed by reference.

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
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License