Company: Arista_27_Dec_MCQ
Difficulty: medium
What is the difference between the functions memcpy and memmove?
How do you declare a pointer to an array of pointers to int?
Given an array A = {7, 9, 4, 5, 6, 3, 10, 7, 100}. Find the inversion count of the array. If (i A[j]), then pair (i, j) is called an inversion of an array A. How many inversions are in the array?
What is the output of the code? unsigned int fact(int x){ return(x*fact(x-1)); } int main(){ int x,y=10; x=4; y=fact(x); printf("%d\n",y); }
Predict the output #include #include int main(){ char char_arr[6]="ORACL"; char c='E'; printf("%s\n",strcat(char_arr,c)); return 0; }
A circular queue of size n (with 0-based indexing) is implemented using an array, with start representing the front and end representing the rear. Which of the following statements is/are true?
Different compilers and host OS behaviors affect how a C program can execute. The following program was compiled with GCC and executed in a linux host. What happens when the following program is executed? int main(void) { char *s = "hello world"; *s = 'H'; }
Which of the following should be used to free the memory allocated using the following statement? int* p = new int[10];
In a virtual memory system that uses the Least Recently Used (LRU) page replacement policy, how many page faults will occur? The number of frames = 4. Reference: 1, 2, 3, 4, 4, 4, 5, 5, 3, 2, 1, 4, 2, 1, 5.
What is the time complexity of this relation? T(n) = T(n-1) + 2n-1, n > 0 T(n) = 0, n = 0
The structure of a singly-linked list is shown below. The following code is expected to find the middle element in a singly-linked list using the two pointer method. Find the error in the code. ListNode* middleNode(ListNode* head) { ListNode* link = head; ListNode* middle = head; while(link!=NULL){ link = link->next->next; middle = middle->next; } return middle; }