1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lions [1.4K]
2 years ago
12

What will the following code display? int numbers[4] = { 99, 87 }; cout << numbers[3] << endl; a. 87 b.0 d. 34. What

will the following code do? const int SIZE = 5; double x[SIZE]; for(int i = 2; i <= SIZE; i++) { x[i] = 0.0; } garbage This code will not compile a. Each element in the array is initialized to 0.0 b. Each element in the array, except the first, is initialized to 0.0 c. Each element in the array, except the first and the last, is initialized to 0.0 d. An error will occur when the code runs
Computers and Technology
1 answer:
pishuonlain [190]2 years ago
7 0

Answer:

1. The output is 0

2. Each element in the array is initialized to 0.0

Explanation:

Solving (a): The output of the code

We have:

<em>int numbers[4] = { 99, 87 }; </em>

<em>cout << numbers[3] << endl;</em>

<em />

The first line initializes the 0 and 1 index of the array to 99 and 87, respectively.

Other elements will be 0, by default.

So, the following code segment will output 0

<em>cout << numbers[3] << endl; </em>

<em />

Solving (b): What the given code will do?

The first and second line declares an array of 5 elements

However, the following iteration will only initialize the array with 0.0 starting from the second

<em>for(int i = 2; i <= SIZE; i++) { x[i] = 0.0; }</em>

<em />

Because, the counter is initialized to start from the second index.

You might be interested in
When should you talk to an adult you trust
Gnesinka [82]

Answer:

you should talk to them when u think its the right time and you think u can trust them

5 0
3 years ago
Write pseudo code that performs the following: Ask a user to enter a number. If the
CaHeK987 [17]
Answer:
BEGIN
INPUT N
IF N>0 AND N<10 THEN
OUTPUT "blue"
ELSE
IF N>10 AND N<20 THEN
OUTPUT "red"
ELSE
IF N>20 AND N<30 THEN
OUTPUT "green"
ELSE
OUTPUT "It is not a correct color option"
ENDIF
END.

Explanation:

3 0
2 years ago
Which is a requirement for searching for a template
Lina20 [59]

Answer:

umm... you did not discribe the anwsers, i cannot help you

8 0
3 years ago
Assignment 2: Room area
Y_Kistochka [10]

Answer:

a = float(input("Enter Side A: "))

b = float(input("Enter Side B: "))

c = float(input("Enter Side C: "))

d = float(input("Enter Side D: "))

e = float(input("Enter Side E: "))

area1 = 1.0* a * b

area2 = (a - c) * (d - e -b)

area3 = 0.5 * (a - c) * e

print ("Room Area: " + str(area1 + area2 + area3))

Explanation:

happy to help ^3^

5 0
3 years ago
A database program helps to ____________.
Juliette [100K]
D. A database is software which is designed to store massive amounts of data and organize them in such a way that information can easily be worked on (added, deleted, moved, etc...).
8 0
3 years ago
Read 2 more answers
Other questions:
  • What steps should Jeremy take to get himself motivated to study for the test?
    12·2 answers
  • Method x1() has code that calls method x2(). Method x2() has the following header.
    7·1 answer
  • Which of the following best define grit
    13·1 answer
  • What does lurch mean
    14·2 answers
  • If we can lock a file, we can solve the race condition problem by locking a file during the check-and-use window, because no oth
    14·1 answer
  • Consider the following program segment: //include statement(s) //using namespace statement int main() { //variable declaration /
    9·1 answer
  • Which company provides a crowdsourcing platform for corporate research and development?
    9·1 answer
  • Assume you are a manager in the security department of a high-tech corporation. You are mentoring Mary, an entry-level network t
    7·1 answer
  • What is an example of a recent development in technology
    11·2 answers
  • Como se llaman las herramientas y maquinas pque utilizan para hacer cosas artesanales
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!