Question

Please Help with the following questions (just true or false, except last one is choose 1)...

Please Help with the following questions (just true or false, except last one is choose 1)

QUESTION 1

Given:

int myvar=99;

Is this expression true or false?

myvar

(That is, is the value of myvar, 99, true or false)

True

False

QUESTION 2

Given:

int myvar=3;

int yourvar=0;

Is the following expression true or false?

myvar == 3 && yourvar == 0

True

False

QUESTION 3

Given:

int myvar=3;

int yourvar=0;

Is the following expression true or false?

myvar == 2 || yourvar == 0

True

False

QUESTION 4

Given:

int myvar=3;

int yourvar=0;

Is the following expression true or false?

myvar == 3 || yourvar != 0

True

10 points   

QUESTION 5

Given:

int myvar=3;

int yourvar=0;

Is the following expression true or false?

myvar || yourvar != 0

True

False

QUESTION 6

Given:

int myvar=3;

int yourvar=0;

Is the following expression true or false?

!myvar || yourvar != 0

True

False

QUESTION 7

Given:

int myvar=3;

I want the expression to be true if myvar is equal to 2 or myvar is equal to 3. What is wrong with the following expression?

myvar == 2 || == 3

-

The expression is fine, there is nothing wrong.

-

The expression is asking if myvar is 2 and myvar is 3. But myvar can't be two numbers at once!

-

> and < should be used, not ==

-

The == is a binary operator (like the addition operator, +, is a binary operator). That means there has to be something on both sides of the operator.

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

Solution:

1)

True

Explanation:

In the expression myvar is assigned a value 99. The expression is correct because the value can be assigned to a variable.Any integer value can be assigned to the variable.


2)

True

Explanation:

The expression is checking the value of the variable myvar and yourvar that is if the value of the myvar is 3 and the value of the yourvar is 0 then the expression will return true. Here, the variabale myvar is assigned a value 3 and the variable yourvar is assigned a value 0 initially. Therefore, it satisfies the condition.


3)

True

Explanation:

The expression is checking the value of the variable myvar and yourvar that is if the value of the myvar is 3 or the value of the yourvar is equal to 0 then the expression will return true. Here, the variabale myvar is assigned a value 3 and the variable yourvar is assigned a value 0 initially. Therefore, it satisfies the condition.


4)

True

Explanation:

The expression is checking the value of the variable myvar and yourvar that is if the value of the myvar is 3 or the value of the yourvar is not equal to 0 then the expression will return true. Here, the variabale myvar is assigned a value 3 and the variable yourvar is assigned a value 0 initially. Therefore, it satisfies the condition.


5)

True

Explanation:

The expression is checking the value of the variable myvar and yourvar that is if the value of the myvar or the value of the yourvar is not equal to 0 then the expression will return true. Here, the variabale myvar is assigned a value 3 and the variable yourvar is assigned a value 0 initially. The value of myvar in the expression always return true because it is not comparing with any other value hence it will return true every time. Therefore, it satisfies the condition.


6)

False

Explanation:

The expression is checking the value of the variable myvar and yourvar that is if the value of the myvar or the value of the yourvar is not equal to 0 then the expression will return true. Here, the variabale myvar is assigned a value 3 and the variable yourvar is assigned a value 0 initially. The value of myvar in the expression always return false because it is not comparing with any other value and there is not operator infront of myvar. Hence it will return false every time. Therefore, it satisfies the condition.

7)

Explanation:

For the expression to be true the expression has to be syntactically correct. Here the expression is not syntactically correct. The correct syntactically expression is:

myvar == 2 || myvar == 3

Hence, the correct option is as follows:

The == is a binary operator (like the addition operator, +, is a binary operator). That means there has to be something on both sides of the operator.

Add a comment
Know the answer?
Add Answer to:
Please Help with the following questions (just true or false, except last one is choose 1)...
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
  • QUESTION 1 Which statement results in the value false? The value of count is 0; limit...

    QUESTION 1 Which statement results in the value false? The value of count is 0; limit is 10. (count != 0)&&(limit < 20) (count == 0)&&(limit < 20) (count != 0)||(limit < 20) (count == 0)&&(limit < 20) 10 points    QUESTION 2 If this code fragment were executed in an otherwise correct and complete program, what would the output be? int a = 3, b = 2, c = 5 if (a > b) a = 4; if (...

  • What is the value of the following expression? true false 0 illegal syntax if x is...

    What is the value of the following expression? true false 0 illegal syntax if x is - 1, what is the value of (!(x = = 0))? false true unable to determine invalid syntax Given the following code, what is the final value of i at the end of the program? int i: for(i = 0: i < =4: i + +) { cout < < i < < endl: }

  • Please answer the following. Select and circle "True" or "False" in the following questions: 26.There is...

    Please answer the following. Select and circle "True" or "False" in the following questions: 26.There is noth ing wrong with the following set of quantum numbers: n=3, / 1, m, = 0, ms = +1/2 True False 27. The following set of quantum numbers is correct. n=3, /=3, m, = 0, ms +1/ 2 True False 28. An electron in a 3p orbital could have a value of 2 for its angular momentum quantum number (). True False 29. A...

  • False Question 32 (1 point) All of the following are characteristic of nonverbal communication EXCEPT a)...

    False Question 32 (1 point) All of the following are characteristic of nonverbal communication EXCEPT a) nonverbal communication is metacommunicative b) nonverbal communication usually conveys more information than verbal communication c) nonverbal communication is the secondary means of communicating emotion d) nonverbal communication is present in most interpersonal conversations Question 33 (1 point) ✓ Saved The "blind" window of the Johari model represents things about yourself that another may know about you, but you do not. a) True b) False...

  • Here is the code I have so far. I'm trying to figure out how to implement...

    Here is the code I have so far. I'm trying to figure out how to implement a boolean and use precedence. The 2nd expression should be 14 but it comes out as 28 so I'm definitely not understanding. #include <stack> #include <iostream> #include <string> using namespace std; // Function to find precedence of // operators. int precedence(char op) {    if (op == '+' || op == '-')        return 1;    if (op == '*' || op ==...

  • Quiz Question 1 (1 point) Saved The maximum value for an int is: Question 1 options:...

    Quiz Question 1 (1 point) Saved The maximum value for an int is: Question 1 options: 2147483647 65535 32767 9223372036854775804 Question 2 (1 point) A float has ____ decimal places of accuracy. Question 2 options: 15 none     7 3 Question 3 (1 point) It is a good practice to compare floats and doubles with ==. Question 3 options: True False Question 4 (1 point) Strings are reference data types. Question 4 options: True False Question 5 (1 point) Value data...

  • Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal...

    Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal '2', a string literal "2", and the numeric literal 2 are identical and stored the same way though they are different types. 3 Since comments do not affect the program execution, you don't need to have it at all. 4. After the following statements are executed, the value of the variable rem is 3. 1. A preprocessor directive line starts with a pound sign...

  • c++ questions need help QUESTION 1 Given the following code, what is the value of *ptr?...

    c++ questions need help QUESTION 1 Given the following code, what is the value of *ptr? int var = 5; int *ptr = &var; int *myptr = ptr; *ptr = -8; var = 0; *myptr = 2; a. 2 b. -8 c. 5 d. 0 QUESTION 2 Given the following code, what is the value of ptr+1? int arr[3] = {0, 0, 0}; int *ptr = arr; *ptr = 8; a. 9 b. undefined c. the address of arr[0] d....

  • QUESTION 1 1. Is the following statement true or false: Letters remain the most formal and...

    QUESTION 1 1. Is the following statement true or false: Letters remain the most formal and legal type of written business communication. True False 1 points    QUESTION 2 Is the following statement true or false: The direct approach is used for letters that have negative messages. True False 1 points    QUESTION 3 Is the following statement true or false: An acknowledgment of accepting a request to do something is a thank you letter. True False 1 points   ...

  • this is true and false for C++ (1 point each) Circle T for true or F...

    this is true and false for C++ (1 point each) Circle T for true or F for false for the following questions. 1. T/F The Boolean expression b1 || b2 evaluates to true if either Boolean value (b1, b2) is true. T/F The code we write in C++ (e.g. code in file project1.cpp) is referred to as source code. 2. 3. T/F The statement float scores[3][3] creates 3 arrays, each containing 3 floating-point variables. T/F For loops work best when...

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
ADVERTISEMENT