Home / MCQ Bank / Computer
Computer Structure And Union

What will be the output of the following C code? #include <stdio.h> int main() { struct p { char *name; struct p *next; }; struct p *ptrary[10]; struct p p, q; p.name = "xyz"; p.next = NULL; ptrary[0] = &p; q.name = (char*)malloc(sizeof(char)*3); strcpy(q.name, p.name); q.next = &q; ptrary[1] = &q; printf("%s\n", ptrary[1]->next->next->name); }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option D • xyz

Related Computer Questions

Which data type is better to use for storing the price of an item? What will be the output of the "hello" +1+2+3? How is polymorphism implemented in C++? Consider the following recursive implementation used to convert a decimal number to its binary equivalent: #include<stdio.h> int arr[31], len = 0; void recursive_dec_to_bin(int n) { if(n == 0 && len == 0) { arr[len++] = 0; return; } if(n == 0) return; __________; recursive_dec_to_bin(n/2); } int main() { int n = 100,i; recursive_dec_to_bin(n); for(i=len-1; i>=0; i--) printf("%d",arr[i]); return 0; } Which of the following lines should be inserted to complete the above code? Consider the following pseudocode for the random page replacement algorithm. Which of the following best suits the blank? Start traversing the pages if pages < capacity { insert the pages until the size of the set reaches capacity or all the pages are processed maintain the pages in a queue increment page fault } else if { current page is present in the set do nothing } else { replace the current page with __________ store current page in the queue increment page fault } return page faults