4. What is stored in each frame? Circle all the correct answers
a. Local variables
b. Static variables
c. Return address
d.Function parameters
e. Global variables
f. Function code
5. A union is a
data type that
A. can only be
declared inside
a struct type
B. is useful for constructing linked lists
C. can only be used with arrays
D. reserves the same space of memory for its fields
E. None of the above
6. What will be the output of the following code Short age [6] =
{25, 28, 29, 30, 31,32};
int *p = NULL;
p = &age[4];
p += 2;
printf(“%d\n”, *p);
A. 28 B. 29 C. 30 D. 31 E. None of the above
7. Which of the following statements is an array of 10 pointers
to an int:
A. int arr[10]*;
B. int *arr[10];
C. int &arr[10];
D. int arr[10]&;
E. int arr[10];
F. None of the above
8. Given the following code, which statement will print True
int x = 5;
int y = 6;
int *p = &x;
int *q = &y int **pp = &p;
int **qq = &q;
A. If (*pp == p) printf (“True\n);
B. If (**pp == *q -1) printf (“True\n”);
C. If (*q == *p) printf (“True\n”);
D. If (*pp == *p) printf (“True\n”);
E. If (*pp == x) printf (“True\n”);
F. If (**qq == y) printf (“True\n”);
G. None of the above
4.
Each frame contain:
5.
Option D
6.
int age [6] = {25, 28, 29, 30, 31,32};
int *p = NULL; // Initially pointer is NULL
p = &age[4]; // it contains the value 31
p+=2; // Pointer goes to next position by default its value is 0
printf("%d\n", *p); // It print 0
Option E
7.
int *arr[10]; contains the array of 10 pointers.
Option B
8.
int x = 5;
int y = 6;
int *p = &x;
int *q = &y; int **pp = &p;
int **qq = &q;
Options:
If (**pp == *q -1) printf (“True\n”);
If (**pp == *q -1) printf (“True\n”);
If (**qq == y) printf (“True\n”);
Options A, B and F are correct.
4. What is stored in each frame? Circle all the correct answers a. Local variables b....
7 - What does the code print to the screen? float x(float) 7/3; printf ( " % .2 f", x); a) 7/3 b) 2.50 c) 2.00 d) None of the above a) TRUE b) FALSE c) TRUEFALSE d) None of the above 8 - What does the code print to the screen? int x3; if (x >31x!-2 printf ("TURE") printf ("FALSE"); 9What does the code print to the screen? a) TRUETRUE b) TRUE c) TRUETRUETRUE d) TRUETRUETRUETRUE e) None of...
Can someone explain these three questions for me? Thanks.
Answers are provided
Use the code segment below for problems 6-7 int x = 1; int y - 0 int z 1: if(! (x && y) ) x 0; İf ( ! (x 11 y) ) y+= (x + y) % 2 == 0 ? 1 : 0; printf ("Total #1 : %d\n", x + y + z); printf ("Total #2: %d\n", !x + !y + !2); 6. Which of the...
24. What will be the output of the following code #include<stdio.h> int main() { char *p; p="%d\n"; p++; p++; printf(p-2, 100); return 0; } a. 100 b. 00 c. 10 d. compiler error e. none of the above 26. What will be the output of the following code #define TRIPPLE(x) (3*x) int x = 4; printf(“triple(%d) = %d \n”,x+1, TRIPPLE(x+1)); a. triple(5) = 12 b. triple(5) = 13 c. triple(4) = 14 d. triple(4) = 15 e. none of the...
10 What does the last printf in this code print to the screen? a)n-7 b)n- 0 c)n--1 d) None of the above 鬐include< stdio. h> int main) int n-0 for (n-7: n<O; n-- printf (n") printf ("n *%d", n); - return 11-What does the code print to the screen? 鬐include< stdio.h> void fun (int) int main) b) 8 d) None of the above fun (3) return void fun (int a) int x-10 while(a !_ 3 x > s} if a...
write solution to the program above in C please and thank
you.
Output all combinations of character variables a, b, and c. If a x,b-y, and c z, then the output is Your code will be tested in three different programs, with a, b, c assigned with Χ. 'y', 'z', then with #. 'S. %, then with T, 23 1 #include 3 int main(void) { char a char b; char c; 4. 7 scanf(" scanf(" scanf(" %c %c %c ",...
QUESTION 9 What will be the output of following code snippet? int a[3] = {1, 2, 3}; int *p = a; int **r = &p; printf("%p %p", *r, a); A. Different memory addresses printed B. 1 2 C. Same memory address printed twice D. 1 1 2 points QUESTION 10 What will be the output of following code snippet? int arr[4] = {1, 2, 3, 4}; int *p; p = arr + 3; *p = 5; printf("%d\n", arr[3]); A....
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...
/* • The following code consists of 5 parts. • Find the errors for each part and fix them. • Explain the errors using comments on top of each part. */ #include <stdio.h> #include <string.h> int main( ) { ////////////////////////////////////////////////////////////////////////// ////////////// Part A. (5 points) ////////////////// int g(void) { printf("%s", Inside function g\ n " ); int h(void) { printf(" % s ", Inside function h\ n "); } } printf("Part A: \n "); g(); printf(" \n"); ////////////////////////////////////////////////////////////////////////// ////////////// ...
1. Select all that are true for the following code. #include <stdio.h> #include <stdlib.h> void range(int start, int end, int *results) { int length = end - start; results = malloc(sizeof(int) * length); for (int i=start; i<end; i++) { *results = i; results++; } } void printArray(int *arr, int length) { for (int i=0; i<length; i++) { printf("%d ", arr[i]); } } int main() { int *x; int s = 2; int e = 11; range(s, e, x); printArray(x, e...
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 +=...