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
15. What will be the output of the following code
int x = 5; int y = 2;
f(x,y);
printf(“%s \n”, (x/y > 2) ? “x is more than two times larger
than y” : “x is less than or equal to 2*y\n ”);
f(int x, int y) { x = 2*y; printf(“%s \n”, (x/y > 2) ? “x is
more than two times larger than y” : “x is less than or equal to
2*y \n”); }
a. x is less than or equal to 2*y x is less than or equal to
2*y
b. x is less than or equal to 2*y x is more than two times larger
than y
c. x is more than two times larger than y x is less than or equal
to 2*y
d.x is more than two times larger than y x is more than two times
larger than y
14) a. The number of bits in x is equal to the number of bits in y
explanation:char occupy 8 bits.
15)
a. x is less than or equal to 2*y x is less than or equal to 2*y
14. Given the following declaration char x = -11; char y = 63; if the computer...
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...
What will be the output of the following code int x = 5; int y = 2; f(x,y); printf(“%s \n”, (x/y > 2) ? “x is more than two times larger than y” : “x is less than or equal to 2*y\n ”); f(int x, int y) { x = 2*y; printf(“%s \n”, (x/y > 2) ? “x is more than two times larger than y” : “x is less than or equal to 2*y \n”); } a. x is...
Create a UNIX makefile for the following C
program:
//convert.c
char toUpper(char c){
if(c>='a' && c<='z')
return c-32;
return c;
}
//converting sentance to upper
void convertSentence(char *sentence){
int i=0;
while(sentence[i]!='\0'){
//convert to upper for each character
sentence[i] = toUpper(sentence[i]);
i++;
}
}
//converting all sentences into uppercase
void convertAll(char **sentenceList, int numOfSentences){
int i=0;
while(i<numOfSentences){
//calling convertsentence function to conver uppercase
convertSentence(sentenceList[i]);
i++;
}
}
sentences.c
#include<stdio.h>
#include<stdlib.h>
#include "convert.c"
int main(){
//declaring character array
char **mySentences;
int noOfSentences;...
C
program
take values to 9 and the second can take values to 12 if (x > 2^3) printf("d", x); Int s-e; 21. LOST) Write a statement that declare an array of doubles with two indices, such that the first index can 22 (LOL) The following code will print out: 23. (L02.) The following code will print out: PART 2 Fill in the banks questions 3 marts x + 5; else x -- 2; char "stri - "abcd"; char str2[]...
D Question 8 1 pts void siq handlerO printf("Beepin-) i alarm(1) int main) ( if (signal (SIGALRM, sig handler) SIOERR) ( prints ("railed to bind handlerin-)? printf ("Going into an intinite loop\nT) alarm(1) while (1) return 0 Suppose the above program is run for 5.5 seconds after it prints "Going into an infinite loop: The program is run multiple times where the "system load" from other processes sharing the cpu will vary from none to many other processes. Which best...
Please solve
the problems from 2_5
Digital
system
Problem 2 Design a combinational circuit with inputs a, b, c, d and outputs w, x, y, z. Assume that the inputs a, b, c d represent a 4-bit signed number (2s complement). The output is also a signed number in 2s complement which is 5 greater than the input if the input is less than 2, and is 2 less than the input if the input is greater than or equal...
Identify and correct the errors in each of the following [Note: There may be more than one error in each piece of code]: a) if ( age >= 65 ); printf( "Age is greater than or equal to 65\n" ); else printf( "Age is less than 65\n" ); b) int x = 1, total; while ( x <= 10 ) { total += x; ++x; } c) While ( x <= 100 ) total +=...
Please solve
the problems from 1_5
Digital
system
Complete the following homework problems. Show all work (making sure it is legible) and circle all answers for clarity Problem 1 w3 w4 B w1 a) Determine Boolean functions for intermediate outputs w,w2,w3, and w4 as well as the output signals X and Y. b) Construct a truth table showing the intermediate outputs wl,w2,w3, and w4 as well as the output signals X and Y c) Use K-maps to find simplified expressions...
Create qz5.c to include all of the following function prototypes: void check1(char *, char, int *); void check2(char *, char, int *); void display(char, int); Then, implement main() to perform the tasks below: Define a 10-element char array with initial values of any lower case letters of your selection. Values can duplicate. Define a pointer that points to the above array. Print the array completely with double spaces before each character. See screenshot below for a sample. Call check1() with...
Asteroids X, Y, and Z have equal mass of 9.0 kg each. They orbit
around a planet with M = 3.20×1024kg. The orbits are in
the plane of the paper and are drawn to scale.
The three asteroids orbit in the same counterclockwise
direction.
greater than less than equal to The angular velocity of
Z at c is .... that at n.
greater than less than equal to The period of Y is ....
that of Z.
greater than less than equal...