Question

12. if x = 0x25 then which of the following statements is correct a) if y...

12. if x = 0x25 then which of the following statements is correct a) if y = x | (1<<1) then y is 0x26 b) if y = x << 1 then y is 0x4A
Review questions COMP 2401 Fall 2019
Page 4 of 14
c) if y = x & 0x37 then y is 0x35 d) if y = x | 0x37 then y is 0x35 e) All of the above statements are incorrect

13. What will be the output of the following code segment? int u = 18; int v = 10; if (u && v) printf(“Fall Term!! ”); if (u & v) printf(“Winter Term!! \n”);

a. Winter Term!! Fall Term!! b.Fall Term!! c. Winter Term!! d. Fall Term!! Winter Term!! e. None of the above

14. Given the following declaration char x = -11; char y = 63; if the computer uses 2’s complement to represent the numbers then which statement is correct: a. The number of bits in x is equal to the number of bits in y b. The number of bits in x is less than the number of bits in y c. The number of bits in x is greater than the number of bits in y d. None of the above

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

12) Answer is: b) if y = x << 1 then y is 0x4A

Wrong options Output 0

a) y = x |(1<<1); then y will be 0x27

c) y = x & 0x37 then y will be 0x25

d)y = x | 0x37 then y will be 0x37

13)

Answer is:  d. Fall Term!! Winter Term!!

Code -

int u = 18;
int v = 10;
if (u && v)
printf("Fall Term!! ");
if (u & v)
printf("Winter Term!! \n ");

Output : Fall Term!! Winter Term!!

Add a comment
Know the answer?
Add Answer to:
12. if x = 0x25 then which of the following statements is correct a) if y...
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
  • 14. Given the following declaration char x = -11; char y = 63; if the computer...

    14. Given the following declaration char x = -11; char y = 63; if the computer uses 2’s complement to represent the numbers then which statement is correct: a. The number of bits in x is equal to the number of bits in y b. The number of bits in x is less than the number of bits in y c. The number of bits in x is greater than the number of bits in y d. None of the...

  • which of the following i.. INVALID identifier in C? A. hot do 1 B. 2ab С.cat1...

    which of the following i.. INVALID identifier in C? A. hot do 1 B. 2ab С.cat1 D. pri 2. Assuming int an, boos which of the following statement avigns b a different value from others A. b a/2 B. b-64--a) D. b a>372:1 3. What's the correct output of the following code int m-1 printtoidm-2) A. 000 B. 123 C. 012 D. None of above 4. What's the output of following code: char str [15]."hello!"; printf( idin",strlen(str)) A. 6 B....

  • Question 1Which of the following statements is syntactically correct in C? A)  print("Winter is coming."); B)  printf("Winter "+"is"+”coming.”);...

    Question 1Which of the following statements is syntactically correct in C? A)  print("Winter is coming."); B)  printf("Winter "+"is"+”coming.”); C)  printf(Winter is coming.); D)  printf("Winter is coming."); E)  None of the Above Question 2 What is the percent code used in scanf for an character? A) %c B) %f C) %d D) %lf E) None of the Above Question 3 What is the value of the following arithmetic expression? 80 – 3 * 12 + 21 / 3  ​ A) 315 B)  37 C)  47 D) 24 E)  None of...

  • 12. Which of the following statements is (are) correct? (x) The legal tender requirement by the...

    12. Which of the following statements is (are) correct? (x) The legal tender requirement by the U.S. government means that people are more likely to accept the U.S. dollar as a medium of exchange. (y) Since the U.S. government has decreed that U.S. currency is legal tender, the government must hold enough gold to redeem all currency. (z) The set of items that serve as media of exchange clearly includes credit cards and short-term bonds. A. (x), (y), and (z)...

  • 1. Minimum number of gates needed to implement (x + ~x * y )(~x + x*~y)...

    1. Minimum number of gates needed to implement (x + ~x * y )(~x + x*~y) Note: ~ means not. Simplify to get the minimum cost. ------------------------------------- 2. Simplify and find the minimum number of gates needed to implement ~((x + ~x * y )(~x + x*~y)) a. 1 b. 2 c. 3 d. 4 e. 5 -------------------------------------- 3. The number of different signed 2's complement numbers representable using 4-bits? a. 18  _b. 17 _c. 16 _d. 15 _e. 14 -----------------------------------------...

  • 9. Which of the following is true for the following program? #include <stdio.h> int maino int...

    9. Which of the following is true for the following program? #include <stdio.h> int maino int i = 1; switch (0) case 1: printf("%d", 0); case 2: printf("%d", 0); case 3: printf("%d", 0); default: printf("%d", 1); return 0; } (2 points) The program has no error, the output is 1111 The program has no error, the output is 1 The program produces a compile time error, because there are no break statements The program produces a compile time error, because...

  • main.c #include <stdio.h> int main() { Tong Tong int x = 1234567890000; char y = (char)...

    main.c #include <stdio.h> int main() { Tong Tong int x = 1234567890000; char y = (char) x; printf("%d\n", y); Compile and run the above main.c file. a) Indicate the compiler command you would use to compile this program. Do any of the following flags affect the compilation? -Wall -Werror -pedantic -Woverflow b) Indicate any discrepancy between expected and actual behavior, and as a programmer, how to construct best practices to avoid this deviation. c) What happens if we do not...

  • Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin,...

    Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin, cout, cin.getline) . Re-make the func function by the following prototype: void func( double, double &); #include int user_interface(); double func(double); void print_table(); int main (int argc, char *argv[]) {    print_table(user_interface());    return 0 ; } int user_interface(int val){    int input = 0;    printf("This function takes in x and returns an output\n");    printf("Enter Maximum Number of X:");    scanf("%d", &input);...

  • State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator...

    State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator moves it from the back toward the front of a list b) The body of a do-while loop is always executed at least once. c) If p points to the array element a[j], then p + i points to a[i+j]. d) Any number of pointer variables may point to the same object. In terms of both execution speed and memory usage usually iterative solutions...

  • Which of the following statements is (are) correct? (x) The average variable cost curve declines as...

    Which of the following statements is (are) correct? (x) The average variable cost curve declines as quantity increases because variable costs always decrease as output increases. (y) The average variable cost curve and average total cost curve will eventually intersect as output increases because average fixed cost eventually becomes negative. (z) The marginal cost curve crosses the average total cost curve at the efficient scale, which occurs at the minimum point on the average total cost curve. A. (x), (y)...

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