Professional Documents
Culture Documents
with REAR = FRONT = 0. Then what should be the condition to detect the full and
empty queue.
2) If 2 stacks are implemented using a single array of size n, each growing from
opposite ends. What would be the condition to check Overflow, so that memory can
be utilized effectively?
a) Allows processes to communicate and synchronize their actions when using the
same address space.
b) Allows processes to communicate and synchronize their actions without using the
same address space.
c) Allows the processes to only synchronize their actions without communication.
d) None of the mentioned
a) Overloading
b) Abstraction
c) Encapsulation
d) None of the above
8) The operating system and the other processes are protected from being modified by
an already running process because:
a) m, n
b) n, m
c) m – n, m
d) m – n, n
a) Syntax Error
b) Runtime Error
c) Executes Successfully
d) Compile Error
class A
{
int a = 0;
}
A ob = new A();
a) Heap
b) Stack
c) Static Storage Area
d) Heap and Stack
a) True
b) Overriding is dynamic polymorphism and Overloading is static polymorphism
c) Overriding is static polymorphism and overloading is dynamic polymorphism
d) Both are static polymorphism
int delete()
{
int x;
if(isEmpty(S2))
{
if(isEmpty(S1))
printf("Empty Queue");
else
while(!isEmpty(S1))
{
x=pop(S1);
push(S2,x);
}
}
return pop(S2);
}
If m insert and n(<=m) delete operation are carried out. If p and q are number of push and
pop performed respectively, Which among the following is True for all m and n?
a) m+n <= p <=2m and 2n <= y <=m+n
b) m+n <= p <=2m and 2m <= y <=2n
c) 2n <= p <=2m and 2m <= y <=n+m
d) 2n <= p <=2m and 2m <= y <=2n
14) What will the output for the given function? Assume Queue has been implemented
and has infinite capacity.
void func(int n)
{
int i,a,b;
Queue q;
insert(q,0);
insert(q,1);
for(i=0;i<n;i++)
{
a=delete(q);
b=delete(q);
insert(q,b);
insert(q,a+b);
printf("%d",a);
}
}
15) When Bubble Sort (ascending order) is applied on array A={78,95,65,99,24}, How
many swaps are done before element 95 is placed at its correct position.
a) 4
b) 7
c) 2
d) 6