latest placement papers of Capgemini
151 / 483
Consider the following code segment in C to traverse a binary tree using the preorder
typedef struct tree {
int info;
struct *left;
struct *right;
}node;
void preorder(node *tree)
{
if (t)
{
Statementl
Statement2
Statement3
}
}
The above Statements should be
Apreorder(tree->right); preorder(tree->left); printf("%d", tree->info);
Bpreorder(tree->left); preorder(tree->right); printf("%d", tree->info);
Cpreorder(tree->left); printf("%d", tree->info); preorder(tree->right);
Dprintf("%d", tree->info); preorder(tree->left); preorder(tree->right);
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
152 / 483
void my_recursive_function(int n)
{
if(n == 0)
return;
printf("%d ",n);
my_recursive_function(n-1);
}
int main()
{
my_recursive_function(10);
return 0;
}
A10
B1
C10 9 8...1 0
D10 9 8...1
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
153 / 483
How will you find the maximum element in a binary search tree?
Case I:
public void max(Tree root)
{
while(root.left() != null)
{
root = root.left();
}
System.out.println(root.data());
}
Case II:
public void max(Tree root)
{
while(root != null)
{
root = root.left();
}
System.out.println(root.data());
}
Case III:
public void max(Tree root)
{
while(root.right() != null)
{
root = root.right();
}
System.out.println(root.data());
}
Case IV:
public void max(Tree root)
{
while(root != null)
{
root = root.right();
}
System.out.println(root.data());
}
ACase I
BCase II
CCase III
DCase IV
Answer: Option C
Explanation:Here is no explanation for this answer
Submit Your Solution
154 / 483
#include <stdio.h>
int main()
{
int a = 1;
switch (a)
case 1:
printf("%d", a);
case 2:
printf("%d", a);
case 3:
printf("%d", a);
default:
printf("%d", a);
}
ANo error, output is 1111
BNo error, output is 1
CCompile time error, no break statements
DCompile time error, case label outside switch statement
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
155 / 483
A NAND gate has
ALOW inputs and a HIGH output
BLOW inputs and a LOW output
CHIGH inputs and a HIGH output
DNone of these
Answer: Option A
Explanation:Here is no explanation for this answer
Submit Your Solution
156 / 483
Convert the following 211 decimal number to 8-bit binary?
A11011011
B11001011
C11010011
D11010011
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
157 / 483
#include <stdio.h>
int main()
{
int i=12;
int *p =&i;
printf("%d\n",*p++);
}
AAddress of i++
B12
CGarbage value
DAddress of i
Answer: Option B
Explanation:Here is no explanation for this answer
Submit Your Solution
158 / 483
Consider the following iterative implementation to find the factorial of a number.
int main()
{
int n = 6, i;
int fact = 1;
for(i=1;i<=n;i++)
_________;
printf("%d",fact);
return 0;
}
Which of the following lines should be inserted to complete the above code?
Afact = fact + i
Bfact = fact * i
Ci = i * fact
Di = i + fact
Answer: Option B
Explanation:Here is no explanation for this answer
Submit Your Solution
159 / 483
#include<stdio.h>
int main()
{
char ch;
int i;
scanf("%c", &i);
scanf("%d", &ch);
printf("%c %d", ch, i);
return 0;
}
AError: suspicious char to in conversion in scanf()
BError: we may not get input for second scanf() statement
CNo error
DNone of above
Answer: Option B
Explanation:Here is no explanation for this answer
Submit Your Solution
160 / 483
For all integral values of n, the expression ((7^2n)-(3^3n)) is a multiple of:
A10
B31
C12
D22
Answer: Option D
Explanation:As this equation should be divisible by a number for all Integral values, Assume n=1
(7^2)-(3^3) = 22
above equation is divisible by 22
Submit Your Solution
Here is the list of questions asked in placement question papers of Capgemini latest placement papers of Capgemini. Practice Capgemini Written Test Papers with Solutions and take Q4Interview Capgemini Online Test Questions to crack Capgemini written round test. Overall the level of the Capgemini Online Assessment Test is moderate. Only those candidates who clear the written exam will qualify for the next round, so practic all the questions here and take all the free tests before going for final selection process of Capgemini