Question

In C++, which of the following numbers will evaluate to ture when used in the condition...

In C++, which of the following numbers will evaluate to ture when used in the condition of an if statement:

a. 1

b. -1

c. 100

d. Al of the above

Note : Please provide a solution

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer is d. All of the above

Reasion : Becouse non zero integers are evaluated as true.

// Here is the code and output which shows the proof.

#include <iostream>
using namespace std;

int main(){
   if(1)
       cout<<" 1 is evaluated true"<<endl;
   else
       cout<<" 1 is evaluated false"<<endl;

   if(-1)
       cout<<" -1 is evaluated true"<<endl;
   else
       cout<<" -1 is evaluated false"<<endl;

   if(100)
       cout<<" 100 is evaluated true"<<endl;
   else
       cout<<" 100 is evaluated false"<<endl;

   return 0;
}

//////============ output =================//CAwindows system32\cmd.exe 1 is eỤaluated true -1 is evaluatedtrue 100 is evaluated true Press апч keч to continue

Add a comment
Know the answer?
Add Answer to:
In C++, which of the following numbers will evaluate to ture when used in the condition...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • e npera ture In A Re xc G Which of the numbers T C Make A...

    e npera ture In A Re xc G Which of the numbers T C Make A Sign Diagram http://www.webassign.net/web/Student/Assignment-Responses/last?dep-21297420 O BemApCalcB/32 029 M Consider the following function. x) = (a) Make a sign diagram for the first derivative. Select- Select- -Select- Select-w Select- X (b) Make a sign diagram for the second derivative. -Select- -Select- -Select- -Select- -Select- -Select- -Solect- X= X (c) Sketch the graph, showing all relative extreme points and inflection points. 2 IP A graphing calculator is...

  • 4.1. Find norms and condition numbers for the following matrices: a) A = ( 1 ;)...

    4.1. Find norms and condition numbers for the following matrices: a) A = ( 1 ;) b) A = ( 3 3 ): Al 5 3). For the matrix A from part a) present an example of the right side b and the error Ab such that Ax| bil here Ax = b and Aax = Ab. llxll || A||||A-11. Abl

  • 1- The term used by Durkhein to explain social condition in which there is a lack...

    1- The term used by Durkhein to explain social condition in which there is a lack of cohesion and social instability is called a) chaos b) anomie c) revolution d) terror 18) Which of the following is NOT a cultural universal: a)marriage b)funeral c)football d) games

  • The following code calculates A = (4 * B) + C in which A, B, and...

    The following code calculates A = (4 * B) + C in which A, B, and C are signed bytes. If C has the decimal value of +28, then what is the largest decimal value for B that allows the code to correctly calculate A = (4 * B) + C as a signed byte? mov al, [B] ; B add al, [B] ; 2 * B add al, al ; 4 * B add al, [C] ; (4 *...

  • Consider the following relation: R(A,B,C,D,E) The following set of functional dependencies are ture on the relation...

    Consider the following relation: R(A,B,C,D,E) The following set of functional dependencies are ture on the relation R: FD: AB -> E, E -> D, AD -> C Which of the following sets of attributes does not functionally determine C? AC ABE BD AE AB

  • 1. Which of the following accounts are used when recording a purchase using a periodic inventory...

    1. Which of the following accounts are used when recording a purchase using a periodic inventory system? a. cash, purchases b. accounts payable, sales c. accounts payable, accounts receivable d. cash, merchandise inventory 2. A multi-step income statement ________. a. separates cost of goods sold from operating expenses b. considers interest revenue an operating activity c. is another name for a simple income statement d. combines cost of goods sold and operating expenses 3. A customer returns $870 worth of...

  • Question 21 The loop condition can be a complex condition involving several operators. True OR False...

    Question 21 The loop condition can be a complex condition involving several operators. True OR False Question 22 final int MAX = 25, LIMIT = 100; int num1 = 12, num2 = 25, num3 = 87; if(num3-5 >= 2*LIMIT) { System.out.println ("apple"); } else { System.out.println ("orange"); } System.out.println("grape"); What prints? A. Apple B. Orange C. Grape D. apple grape E. orange grape F. Nothing. Question 23 When we use a while loop, we always know in advance how many...

  • Q7 Homework – Unanswered Which of the following would show the financial condition of a corporation?...

    Q7 Homework – Unanswered Which of the following would show the financial condition of a corporation? Income statement 0 B balance sheet o C cash flow statement O D none of the above Unanswered 2 attempts left 57 Submit Q8 Homework – Unanswered Which of the following is the best definition of liquidity? O A Turning an asset into cash quickly and for value O B Turning an asset into cash. O C How fast fixed assets can be turned...

  • When the following equation is balanced with the lowest set of whole numbers, what is the...

    When the following equation is balanced with the lowest set of whole numbers, what is the coefficient of H2O? Al(OH)3 + H2SO4 --> Al2(SO4)3 + H2O Select one: a. 1 b. 3 c. 6 d. 2

  • Which of the following was NOT a capital budgeting metric used to evaluate the Merseyside project?...

    Which of the following was NOT a capital budgeting metric used to evaluate the Merseyside project? (Identify all correct answers) Select one or more: a. NPV b. EPS c. IRR d. Payback period e. Duration

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT