28th August Batch Questions - Capgemini
1.
- 19
- 3
- 23
- 18
2.
- 9
- 2
- -6
- 8
3.
- 6 9
- 9
- 6
- 13
4.
- 2 1 1
- 1 0 3
- 1 1 2
- 1 3 2
5.
- 2
- 1
- 3
- 8
1.
2.
3.
4.
5.
1.
2.
3. a=2
4. a=2
5.
I am a student, I do not earn money and belongs to a poor family, I am hardly affording my school fee. My father income is not sufficient, He has a large family to support, I can't even buy new books and clothes. I am completing my studies on Scholarship basis that is provided by my school.
Ii want to complete this specialization.I need this financial aid so that I can learn how to make applications from some reputed institute. I will be able to create some projects based on this course and support my family.
In today's Information technology world, It has a large market to work on. I also want to be a part of this market. But unfortunately, I have no money to achieve this precious opportunity,
Please help me and give me financial aid. I will be extremely grateful to you for this act of kindness.
Thank you.
This course will definitely help me to achieve career goals. I need this financial aid so that I can learn how to make codes for some reputed institute. I will be able to create some projects based on this course and support my family.
In today's Information technology world, It has a large market to work on. I also want to be a part of this market. But unfortunately, I have no money to achieve this precious opportunity,
The people around me are learning these courses to secure their future I do not want to become the tail light follower. I also want to be the professional in this field. For this purpose whatever is needed, I will definitely do it. Here I have a financial aid opportunity, Please help me I really need this.
Please help me and give me financial aid. I will be extremely grateful to you for this act of kindness.
Thank you.
No, I am a student and belongs to a very poor family where I am hardy affording my college fee. I have no money to buy new books to learn. I do not earn money that's the reason I can not afford the low-interest loan. Please help me and give me financial aid. I am so ambitious to learn this course.
1) What is the time complexity of searching for an element in a circular linked list?
a) O(n)
b) O(nlogn)
c) O(1)
d) None of the mentioned
Ans: Option A
2) In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
a) log 2 n
b) n?2
c) log 2 n 1
d) n
Ans: Option D
3) Which of the following will give the best performance?
a) O(n)
b) O(n!)
c) O(n log n)
d) O(n^C)
Ans: Option A
4) How many times the following loop be executed?
{
ch = b;
while(ch >= a && ch <= z)
ch++;
}
a) 0
b) 25
c) 26
d) 1
Ans: B
5) Consider the following piece of code.What will be the space required for this code?
int sum(int A[], int n)
{
int sum = 0, i;
for(i = 0; i < n; i++)
sum = sum + A[i];
return sum;
}
// sizeof(int) = 2 bytes
a) 2n + 8
b) 2n + 4
c) 2n + 2
d) 2n
Ans: A
6) What will be the output of the following pseudo code?
For input a=8 & b=9.
Function(input a,input b)
If(a<b)
return function(b,a)
elseif(b!=0)
return (a+function(a,b-1))
else
return 0
a) 56
b) 88
c) 72
d) 65
Ans: C
7) What will be the output of the following pseudo code?
Input m=9,n=6
m=m+1
N=n-1
m=m+n
if (m>n)
print m
else
print n
a) 6
b) 5
c) 10
d) 15
Ans: D
8) What will be the value of s if n=127?
Read n
i=0,s=0
Function Sample(int n)
while(n>0)
r=n%l0
p=8^i
s=s+p*r
i++
n=n/10
End While
Return s;
End Function
a) 27
b) 187
c) 87
d) 120
Ans: Option C
9) What will be the output of the following pseudocode?
Integer n
for (n = 3; n != 0; n--)
Print n
n = n-1
end for
a) 3 1
b) 3 2 1
c) 3
d) Infinite Loop
Ans: Option D
11) What will be the value of even_counter if number = 2630?
Read number
Function divisible(number)
even_counter = 0, num_remainder = number;
while (num_remainder)
digit = num_remainder % 10;
if digit != 0 AND number % digit == 0
even_counter= even_counter+1
End If
num_remainder= num_remainder / 10;
End While
return even_counter;
a) 3
b) 4
c) 2
d) 1
Answer: Option D
12) What will be the value of t if a =56 ,b = 876?
Read a,b
Function mul(a, b)
t = 0
while (b != 0)
t = t + a
b=b-1
End While
return t;
End Function
a) 490563
b) 49056
c) 490561
d) None of the mentioned
Ans: Option B
13) Code to sort given array in ascending order:
Read size
Read a[1],a[2],a[size]
i=0
While(i<size)
j=i+1
While(j<size)
If a[i] < a[j] then
t= a[i];
a[i] = a[j];
a[j] = t;
End If
j=j+1
End While
i=i+1
End While
i=0
While (i<size)
print a[i]
i=i+1
End While
Find out the wrong statement in the above pseudocode
a) Line 4
b) Line 6
c) Line 7
d) No Error
Ans: Option C
14) What will be the output of the following pseudo code?
Input f=6,g=9 and set sum=0
Integer n
if(g>f)
for(n=f;n<g;n=n+1)
sum=sum+n
End for loop
else
print error message
print sum
a) 21
b) 15
c) 9
d) 6
Ans: A
15) Consider a hash table with 9 slots. The hash function is h(k) = k mod 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are
a) 3, 0, and 1
b) 3, 3, and 3
c) 4, 0, and 1
d) 3, 0, and 2
Ans: A
16) You have an array of n elements. Suppose you implement a quick sort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is:
a) O(n2)
b) O(nLogn)
c) ?(nLogn)
d) O(n3)
Ans: A
17) Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time on Depth First Search of G? Assume that the graph is represented using adjacency matrix.
a)O(n)
b)O(m+n)
c)O(n2)
d)O(mn)
Ans: C
18) Let P be a Quick Sort Program to sort numbers in ascending order using the first element as a pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?
a)t1 = 5
b)t1 < t2
c)t1 > t2
d)t1 = t2
Ans: C
19) What does the following piece of code do?
public void func(Tree root)
{
func(root.left());
func(root.right());
System.out.println(root.data());
}
a)Preorder traversal
b)Inorder traversal
c) Postorder traversal
d)Level order traversal
Ans: C
20) How will you find the minimum element in a binary search tree?
a) public void min(Tree root)
{
while(root.left() != null)
{
root = root.left();
}
System.out.println(root.data());
}
b) public void min(Tree root)
{
while(root != null)
{
root = root.left();
}
System.out.println(root.data());
}
c) public void min(Tree root)
{
while(root.right() != null)
{
root = root.right();
}
System.out.println(root.data());
}
d) public void min(Tree root)
{
while(root != null)
{
root = root.right();
}
System.out.println(root.data());
}
Ans: a