Amcat Material
Amcat Material
h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x <5)
continue;
else
break;
printf("SVES");
}
return0;
}
How many times “SVES” is printed
a. 0 times
b. 10 times
c. 11 times
d. Infinite times
4.
a. 1
b. n-1
c. (n*(n-1))/2
d. (n*(n-1))
7.Which of the following data structures can handle updates and queries in log(n) time on an
array?
a. Stack
b. Queue
c. Linked List
d. Segment Tree
8.Pushing an element into stack already having five elements and stack size of 5 , then stack
becomes
a) Overflow
b) Crash
c) Underflow
d) User flow
9. What is the time complexity to count the number of elements in the linked list?
a) O(1)
b) O(n)
c) O(logn)
d) None of the mentioned
1. #include <stdio.h>
2. void main()
3. {
4. int x =5;
5. if(x <1)
6. printf("hello");
7. if(x ==5)
8. printf("hi");
9. else
10. printf("no");
11. }
a) hi
b) hello
c) no
d) None of the mentioned
a. 4
b. 5
c. 6
d. 7
while(m<n)
if(x>y )and(a<b)then
a=a+1
y=y-1
endif
m=m+1endwhile
A. 2
B. 3
C. 4
D. 5
18. a sorted array of n elements contains 0 and 1. to find out majority of 0 and 1 how much ime it
will take?
1)O(1)
2)O(logn)
3)O(n)
4)O(n^2)
19. How many times is the comparison i>=n performed in the following program?
int i=85, n=5;
main(){
while(i >= n){
i=i-1;
n=n+1;
}
}
A. 40
B. 41
C. 42
D. 43
20. A binary tree T has 20 leaves. The number of nodes in T having two children is ______.
a. 21
b. 19
c. 40
d. 41