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
laiz [17]
3 years ago
7

Int a = 1; int b = 0; int c = -1; if ((b + 1) == a) { b++; c += b; } if (c == a) { a--; b = 4; }

Computers and Technology
1 answer:
dimulka [17.4K]3 years ago
8 0

Answer:

a = 1

b = 1

c = 0

Explanation:

Given

The above code segment

Required

The final values of a,\ b\ \&\ c

The following line declares and initializes the values of a, b and c

int a = 1;     int b = 0;     int c = -1;

So, we have:

a = 1; b =0; c = -1

Next, the following if condition is tested

if ((b + 1) == a)

b + 1 =0 +1

b + 1 = 1

And:

a = 1

So,

b + 1 = a = 1

Since the condition is true, the statements in the curly brace { } will be executed;

b++ \to b = b+1 \to b = 0 + 1 \to b = 1

So:

b = 1

c += b \to c = c+b \to c = -1 + 1 \to c = 0

So:

c = 0

Next, the following if condition is tested

c == a

c = 0 and a =1

So:

c \ne a

That means, the statements in its curly brace will not be executed.

So, the final values of a, b and c are:

a = 1

b = 1

c = 0

You might be interested in
.Choose the extention of Scratch Project<br><br><br> .sb2<br><br> jpeg<br><br> .exls
Ratling [72]

Answer:

I know about .sb3, and it similar to .sb2

that might be your answer.

Explanation:

jpeg is for pictures and .exls is Microsoft's excel

extension.

4 0
3 years ago
Read 2 more answers
Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data from cin (console) and gives
mafiozo [28]

Answer:

Following are the code to this question:

#include<iostream>//import header file

using namespace std;

int main()//defining main method

{

int ar[7];//defining 1_D array that stores value      

int i,x=0,l1=1,j; //defining integer variable

for(i=0;i<7;i++)//defining for loop for input value from user ends  

{

cout<<"Enter a Number: ";//print message

cin>>ar[i];//input value in array

if(l1<=2 && i>0)//using if block that checks the array values  

{

x++;//increment the value of x by 1  

}

if(l1>2 && i>0)//using if block that checks the array values  

{

l1=l1-2;//using l1 variable that decrases the l1 value by 2  

}

j=i-x;//using j variable that holds the index of the root of the subtree

if(i>0 && ar[j]>ar[i])// use if block that checks heap condition  

{

l1++; //increment the value of l1 variable

}

if(i>0 && ar[j]<ar[i])// using the if block that violate the heap rule  

{

cout<<ar[i]<<" "<<"Violate the heap";//print message with value

break;//using break keyword  

}

}

return 0;

}

Output:

1)

Enter a Number: -15

Enter a Number: -5

-5 Violate the heap

2)

Enter a Number: 45

Enter a Number: 0

Enter a Number: 55

55 Violate the heap

Explanation:

  • In the above-given C++ language code, an array "ar" and other integer variables " i,x,l1, j" is declared, in which "i" variable used in the loop for input values from the user end.
  • In this loop two, if block is defined, that checks the array values and in the first, if the block it will increment the value of x, and in the second if the block, it will decrease the l1 value by 2.
  • In the next step, j variable is used that is the index of the root of the subtree. In the next step, another if block is used, that checks heap condition, that increment the value of l1 variable. In the, if block it violate the heap rule and print its values.
5 0
3 years ago
And<br>Why the computer is called dilligent<br>Versatile machine?give long answer ​
WITCHER [35]

Answer:

The answer to this question is given below in this explanation section.

Explanation:

"Why the computer is called diligent

Versatile machine"

Computer is called versatile machine because it is used in almost all the fields for various purposes.Because it can perform the task repeatedly without loosing its speed and accuracy for a long time.They are versatile because they can be used for all sorts of task.They can also do many of the same tasks in different ways.Computer is the electronic device which perform the logical and mathematical calculation.Computer is known as the  versatile machine because it is very fast in every field and its part of life without it was cannot imagine life.

It can do the work faster and in every field the computer is used for making their work faster.

It can perform the work fast so it is called versatile machine.

Advantages of versatile machine:

  • Computer are very fast due to which thousand of job can be performed within the short period of time.
  • Complex mathematical problems and logical operations can be solved by using this computer.
  • As computer is versatile device,multiple task like communication,graphics,documentation can be done.

Disadvantages of versatile machine:

  • Computers are machine hence they have no brain so they work according to the program instruction set inside it.
  • It is an electronic deice and it uses electronic sources to work,So it is very risk to store data and information on the computer independently because some electric and electronic damages may damage the data.So we have to make regular backup of the data.

5 0
3 years ago
The CPI is a measure of the overall cost of the goods and services bought by a. a typical consumer, and the CPI is computed and
Akimi4 [234]

Answer:

a typical consumer, and the CPI is computed and reported by the Bureau of Labor Statistics.

Explanation:

The CPI is a measure of the overall cost of the goods and services bought by a typical consumer , and the CPI is computed and reported by the Bureau of labor statistics. Hence, option C is correct.

5 0
3 years ago
Gregor installed a third stick of known-good RAM into his Core i7 system, bringing the total amount of RAM up to 3 GB. Within a
MA_775_DIABLO [31]

Answer:

The speed or quality was different.

Explanation:

The new ram that he installed most likely had a different rate, or was a different quality than the old ram.

5 0
3 years ago
Other questions:
  • What was the purpose of the Declaration of Independence and what led to it​
    10·1 answer
  • Identify the four basic categories of hardware in a personal computer system
    7·1 answer
  • The measure of the maximum amount of data that can travel through a computer’s communications path in a given amount of time is
    9·1 answer
  • What is a slide master ?
    8·2 answers
  • Why must you be careful when handling a hard drive?
    10·1 answer
  • Juan has performed a search on his inbox and would like to ensure the results only include those items with attachments which co
    14·2 answers
  • You have an audio that contains one pause for 0.2 seconds and another one for 0.6 seconds. When do you need to create a new segm
    5·1 answer
  • ________________, _______________ and ___________ are what you see when you open Excel
    14·2 answers
  • Which of the following is not considered essential for an electronic device to be called a computer?
    15·1 answer
  • What is the shortcut key to create a new desktop ​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!