C++ programming language allows both auto(or stack allocated) and dynamically allocated objects. In java & C#, all objects must be dynamically allocated using new. C++… Read More »
Given a singly linked list, sort it using bubble sort. Input : 10->30->20->5 Output : 5->10->20->30 Input : 20->4->3 Output : 3->4->20 filter_none edit close… Read More »
The C standard says following about main function in C. The function called at program startup is named main. The implementation declares no prototype for… Read More »
A year is leap year if the following conditions are satisfied: Year is multiple of 400. Year is multiple of 4 and not multiple of… Read More »
Like Stack, Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO).… Read More »
Predict the output of following C programs. filter_none edit close play_arrow link brightness_4 code // PROGRAM 1 #include <stdio.h> int main(void) { int arr[] =… Read More »
The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning.… Read More »
Given two variables, x and y, swap two variables without using a third variable. Method 1 (Using Arithmetic Operators) The idea is to get sum… Read More »
filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() { if (sizeof(int) > -1) printf(“Yes”); else printf(“No”); return 0; } chevron_right filter_none (A)… Read More »
Some code optimizations are carried out on the intermediate code because (A) they enhance the portability of the compiler to other target processors (B) program… Read More »
Given f1, f3 and f in canonical sum of products form (in decimal) for the circuit A) m(4, 6) B) m(4, 8) C) m(6, 8) D) m(4, 6, 8)… Read More »
We basically ignore half of the elements just after one comparison. Compare x with the middle element. If x matches with middle element, we return… Read More »
(A) 1 (B) -1 (C) INF (D) -INF Answer: (A) Explanation: Quiz of this Question My Personal Notes arrow_drop_up Save
The enter_CS() and leave_CS() functions to implement critical section of a process are realized using test-and-set instruction as follows: void enter_CS(X) { while test-and-set(X) ;… Read More »
In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state: Now consider the… Read More »
Which of the above two are equivalent? (A) I and III (B) I and IV (C) II and III (D) II and IV Answer: (B)… Read More »
Given a binary tree, where every node value is a Digit from 1-9 .Find the sum of all the numbers which are formed from root… Read More »
Predict the output of following program? filter_none edit close play_arrow link brightness_4 code # include <stdio.h> int main() { int x = 10; int y… Read More »
filter_none edit close play_arrow link brightness_4 code #include<stdio.h> int main() { int a = 2,b = 5; a = a^b; b = b^a; printf(“%d %d”,a,b);… Read More »
There are 25 horses among which you need to find out the fastest 3 horses. You can conduct race among at most 5 to find… Read More »