2.(25pts) For the following code specify which of the variables
a,b,c,d are type equivalent under (a) structural equivalence, (b)
strict name equivalence, and (c) loose name equivalence.
Type T = array [1..10] of integer
S = T
a: T
b: T
c: S
d: array [1..10] of integer
All four arrays are structurally equivalent. Under name equivalence, array D is incompatible with the others. Under strict name equivalence A and B are also incompatible with C under loose name equivalence A, B, and C are all mutually compatible.
2.(25pts) For the following code specify which of the variables a,b,c,d are type equivalent under (a)...
Consider the two variables in the following C-like (not C) code. Assume that both types of long and int use 32 bits. Do the variable a and b have equivalent type under name type equivalence? What if under structure type equivalence? 0 struct {char c1[4],c1; int i;} a; struct {char c1[2],c2[3]; long l;} b;
Consider the following type declarations
TYPE A A Ti 12 T3 T4 TS TO T7 TH intage pointer to float: pointer to Integer structurex Integer structure X A; next pointer to inte structura inter l oat structure float: aInteger structure la pointer to 15 pointer to TS structure la pointer to T i pointer to 15 structure la pointer to T i pointer to structure la pointer to 17 pointer to TS pointer to T7 pointer to 15 pointer to...
A. What is the output of the following C++ code fragment? (all variables are of type int) int count-1; int y-100; while (count 3) y=y-1 ; count+t cout << y << endl; cout<< count <<endl What is the value of x after control leaves the following while loop? (all variables are of type int) B. int x0 while (x < 20) sum- sum+x cout << sum<< endl;
Convert the following C fragment to equivalent MIPS assembly language. Assume that the variables a, b, c, d, i and x are assigened to registers $t1, $t2, $t3, $t4, $s0 and $s1 respectively. Assume that the base address of the array A and B is in register $a0 and $a1 respectively. if (a > 0) b = a + 10; else b = a - 10;
C++Implement only (source code) a program to determine whether two two-dimensional arrays are equivalent or not. Two arrays are equivalent if they contain the same values in any order. The program main method defines two two-dimensional array of size 3-by-3 of type integer, and prompts the user to enter integer values to initialize the arrays. The main method calls method isEquivalent()that takes two two-dimensional arrays of integer and returns true (boolean value) if the arrays contain the same values in...
2.)Which character is used to denote a comment? A.) # B.) \ C.) % D.) ' 3.)Which of these tasks is impacted by both Option Strict and Option Explicit? A.) Declaring a variable B.) Masking C.) Interpreting an event D.) Casting a variable at some point after it has been declared 4.) What happens when you type a line such as this: variable *=5 A.) Multiply the current value of the variable by 5 and store it as variable B.)...
2) Write an assembly program that is algorithmically equivalent to the following C+t code Consider the variables to be 8-bit unsigned integers; you may initialize them to any values 0-255 if you like for testing purposes 13 int speed, lower, a, b; 14 15 if (speed < 98) { 16 17 if (speed <80) t 18 lower++; 19 20 21 else f 23 24 25 26 else t 27 28
2) Write an assembly program that is algorithmically equivalent to...
C code only! Complete this function so that the function str2int convert the char array s into its equivalent integer value. The char array has only digit characters of{0, 1, .., 9}and ’\0’.And the first element is not 0, which means, the integer string in the char array is of base 10. For example, if we pass chars[] = ”123” intostr2int, then it should return 123.Close the braces when you are done int str2int(char s[]){
Fix each of the following code by converting the type of the variables: a. double x = 1.5; int y = x b. String x = "1"; Int y = x; c. int x = 1; String y = x; d. double x = 1.0; String y = x;
Question 17 2 pts A pointer is: A keyword used to create variables A variable that stores address of an instruction A variable that stores address of other variable A macro defined as a preprocessor directive. 2 pts Question 18 The operator used to get value at address stored in a pointer variable is: O& && O II Question 19 2 pts In the following code what is 'P: typedef char *charp; const charp P; Pis a constant Pis a...