Question

Q.1)) (12.5 marks) Given the values below, what is the value of each of the following expressions (0 or 1)? INTEGER :: age=34
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Integer :: age = 34, old = 92, young = 16

1. age /= old -> 0 Reason : age and old are integer variables, Their division will result in a floating point number but the it will only store the integer part of the number[i.e, value before decimal point]. age = age / old => age = 34 / 92 => 0 [34/92 = 0.395652, but it will only store 0]

2. (age == 56 AND old /= 92) -> 0 Reason : age is equals to 32. That means, age == 56 is a false statement it will result in 0. old /= 92 will result in 1 but will not make any difference because: 0 AND 1 = 0

3. (age == 56 OR old /= 92) -> 1 Reason : age is equals to 32. That means, age == 56 is a false statement it will result in 0. old /= 92 will result in 1.But we are dealing with OR operator here and we know that: 0 OR 1 = 1

4. (age == 56 OR (NOT(old /= 92)) -> 0 Reason : age is equals to 32. That means, age == 56 is a false statement it will result in 0. old /= 92 will result in 1 but NOT operator will invert the result that means 1 will become 0 and we know that 0 OR 0 = 0.

5. NOT((age == 56 OR old /= 92)) -> 0 Reason : age is equals to 32. That means, age == 56 is a false statement it will result in 0. old /= 92 will result in 1. But the NOT operator outside the whole statement will negate the result and we will get 0.

6. (young < old) NEQ (young >= 16) -> 0 Reason : young is less than old this statement is true and will result in 1. young >= 16 is also true and will result in 1 but NEQ means not equals to i.e., 1 != 1 ,and this is a false satement therefore it will result in 0.

7. young<age<old -> 1 Reason : young is less than age(16<34) and age is less than old(34<92)

8. NOT(young /= old) -> 1 Reason : young /= old will result in 0 but after negating it we will get 1.

Add a comment
Know the answer?
Add Answer to:
Q.1)) (12.5 marks) Given the values below, what is the value of each of the following...
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
  • 9. Given the following data, determine the nu- merical value of each of the expressions below....

    9. Given the following data, determine the nu- merical value of each of the expressions below. Person (i) X, 610 99/ 4 5 25 4 0 7 49 749 8 i.ΣΧ Xi 10. Given the data from Exercise 9 for X and Yan that c, a constant, equals 3, determine the nu merical value for the following expressions:

  • For the cash flow, interest rate and compounding frequency given below, what value of Q will...

    For the cash flow, interest rate and compounding frequency given below, what value of Q will make the inflows and outflows equivalent? Compounding/y NPERY 365 APR (nom/y) NOMINAL 18.00% Year Cash Flow 0 ($25,000) 1 -15*Q 2 +30*Q 3 $0 4 +12*Q 5 -14*Q 6 -2*Q 7 +6*Q 8 $0 9 -15*Q 10 -5*Q Group of answer choices $4,327 $8,347 $14,101 $22,891

  • Problem 1 (12.5 marks) A uniform plane wave is normally incident as shown in the figure...

    Problem 1 (12.5 marks) A uniform plane wave is normally incident as shown in the figure below. Assume that all regions are lossless. Prove that the input intrinsic impedance can be given by 13 cos(B21) + 1 n2 sin(21) Min = 12 n2 cos(B21) + j n, sin(B,1) 92 73 incident wave -1 nin 0 ho

  • Part A: • Determine the next value of Q for the given values of S and...

    Part A: • Determine the next value of Q for the given values of S and R. S = 0, R = 1 • Assume that the present value of Q can be either 0 or 1. Note: Qt denotes the next value of Q. RO a) Q+ = 0 b) Q+ = 1 C) Q and Q’ do not change. d) Q and Q’ toggle. e) None of the above. $ 0 Dos not SR Latch Part B: •...

  • Q2. Using the table given below, determine the return value of each of the following: (K/U...

    Q2. Using the table given below, determine the return value of each of the following: (K/U 8 marks) s1.compare To(s2) For distinct characters: If... compare To() returns... s1 greater than s2 s1 equal to s2 a positive integer the integer value 0 a negative integer s1 less than s2 a) "happy".compareTo("HAPPY") b) "123abc".compareTo("abc123") I c) "hello, world".compare To("hello," + "world") d) "".compareTo("") e) "television".compareTo("TV") f) "12".compareTo("2") g) "sweet".compareTo("sweet-tooth") h) "one".compareTo("eighty")

  • Farttex 1-6 marks) For the date given below; 6, 0, 2,-1, 5,6 I, The expected value...

    Farttex 1-6 marks) For the date given below; 6, 0, 2,-1, 5,6 I, The expected value of x is 2. The variance of s is 3. Ihe median is (0) 3 th) () 6 (d) 5 (a) 167 (b) 7.8 (e) 2.79 (d) 3.2 (b) 4 (c) 3.5 (d) 8 4. The mode is (a) 4 The range isg (a) S (h) H (c) 3 (d) 6 (h) H (c) 7 (d) 6 Panta· (2 mark) For o normal population...

  • You are given a binary tree of the form: Each node in the tree has a...

    You are given a binary tree of the form: Each node in the tree has a left child and a right child. Each of the children will be extended as a linked list. Every node has the following attributes: key, left node, right node, and next node. The next node allows a node, that is a part of the tree, to be extended as a linked list. The diamonds represent the next nodes, which are part of the linked list...

  • Given a string containing space-separated integer values, compute the sum of those values. Each string will...

    Given a string containing space-separated integer values, compute the sum of those values. Each string will contain at least one number. sumString("1 2") → 3 sumString("1 2 3") → 6 sumString("7 -7 0 59") → 59 int sumString(String str) {    }

  • JAVA: (15 marks) Write a program that creates an integer array with 50 random values, prompts...

    JAVA: (15 marks) Write a program that creates an integer array with 50 random values, prompts the user to enter the index of an element in the array between 0 and 49, then displays the corresponding element value. If the specified index is out of bounds, display an error message (e.g. "Out of Bounds") and ask the user to enter another index. Use a while loop that will keep prompting the user until a valid input is received. To handle...

  • Given the following cash inflow at the end of each​ year, what is the future value...

    Given the following cash inflow at the end of each​ year, what is the future value of this cash flow at 3 %​, 8 %​, and 16​% interest rates at the end of year​ 7? Year​ 1: ​$13 comma 000 Year​ 2: ​$22 comma 000 Year​ 3: ​$32 comma 000 Years 4 through​ 6: ​$0 Year​ 7: ​$140 comma 000 What is the future value of this cash flow at 3​% interest rate at the end of year​ 7?

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