Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3789280 • Letter: P

Question

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.

-

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.

Explanation / Answer

1) int myvar=99;

True


2) int myvar=3;
int yourvar=0;
myvar == 3 && yourvar == 0

True


3) False


4) False


5) True


6) False