1. What is the output of the following C program and Explain WHY??? int x; int *
ID: 3918880 • Letter: 1
Question
1. What is the output of the following C program and Explain WHY???
int x;
int *ptr; };
}
2. What is the output of the following C program and explain WHY?
int k;
char c; };
int main() {
}
3. What is a node used for in a linked list(choose all that apply)?
a. To store the information and the link to the next item.
b. To check for the end of the list.
c. Not used in a linked lists.
4. What is the output of the following C program and explain WHY????
};
int main() {
5. What is the output of the following C program and explain WHY????
6. What does the following fragment of code do with a linked lists?
7. The below C declaration define 's' to be (choose that applies)
struct node {
int i;
float j; };
a. An array, each element of which is a pointer to a structure of type node.
b. A structure of 2 fields, each field being a pointer to an array of 10 elements.
c. A structure of 3 fields, an integer, a float, and an array of 10 elements.
d. An array, each element of which is a structure of type node.
5. What does the following function do for a given Linked Listst with first node as head?
9. Which of the following is not a disadvantage to the usage of array?
a. Fixed Size
b. You know the size of the array prior to allocation.
c. Insertion based on position
d. Accessing elements at specified positions
10. Point out the error in the following code and explain WHY????
struct emp {
int ecode;
11. Point out the error in the following program?
struct emp {
char n[20];
int age; };
}
Explanation / Answer
1.
OUTPUT: 66, 23
Explanation:
// it is setting x of temp to 66
temp.x = 66;
// ptr is pointing to address of x which has value 23
temp.ptr = &x;
2.
error: 'p' undeclared (first use in this function) p.k = 20;
Explanation: There isn't any name given to struct to declare a variable for it.
3.
a. To store the information and the link to the next item.
b. To check for the end of the list.
4.
OUTPUT: A
EXPLANATION: x.c has value 65 which is ASCII value of A
1.
OUTPUT: 66, 23
Explanation:
// it is setting x of temp to 66
temp.x = 66;
// ptr is pointing to address of x which has value 23
temp.ptr = &x;
2.
error: 'p' undeclared (first use in this function) p.k = 20;
Explanation: There isn't any name given to struct to declare a variable for it.
3.
a. To store the information and the link to the next item.
b. To check for the end of the list.
4.
OUTPUT: A
EXPLANATION: x.c has value 65 which is ASCII value of A
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.