0% found this document useful (0 votes)
79 views76 pages

Fiat - Capgemini 1 1

Uploaded by

heybuddy900
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views76 pages

Fiat - Capgemini 1 1

Uploaded by

heybuddy900
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

CAPGEMINI

SPECIFIC TRAINING
JECRC UNIVERSITY,
JAIPUR

FIAT TECHNOLOGIES
Q.1
What will be the space required for this piece of code?
int sum (int B[], int n)
{
int s = 0, j;
for (j = 0; j < n; j++)
s = s + B[i];
return s;
}// sizeof(int) = 2 bytes
A. 2n+8
B. 2n+4
C. 2n+2
D. 2n
Q.2
What will be the output of the following pseudo code?
For input e = 7 & f = 8.
work (input e, input f)
If (e < f)
return work (f, e)
elseif (f != 0)
return (e + work (e, f - 1))
else
return 0
A. 72
B. 88
C. 56
D. 65
Q.3
What will be the output of the following pseudo code?
Input p = 9, w = 6 ,
p=p+1;
w=w-1;
p=p+w
if (p > w)
print p
else
print w
A. 6
B. 5
C. 10
D. 15
Q.4
What will be the output of the following pseudo-code?
Input t = 6, h = 9 and set x = 0
Integer c
if (h > t)
for (c = t; c < h; c = c + 1)
x=x+c
End for loop
print x
else
print error message print x
A. 21
B. 15
C. 9
D. 6
Q.5
What will be the output of the following pseudo code?
integer i
set i=3
do
print i+3
i=i-1
while( i not equals 0)
end while
A. 654
B. 656
C. 555
D. 666
Q.6
What will be the output of the following pseudocode for input a =
30, b = 60, C = 90?
Integer a, b, c, sum
Read a, b, c
Set sum = a + b + c
if ((sum EQUALS 180) and (a NOT EQUALS 0) and (b NOT
EQUALS 0) and (c NOT EQUALS 0))
Print " Success"
Otherwise
Print "Fail"
End if
A. Success
B. Fail
C. Compilation error
D. None of the above
Q.7
What will be the output of the following pseudocode for a = 2, b = 6?
Integer funn(Integer a, Integer b)
if(a > 0)
if(b > 0)
return a + b + funn(a + 1, 0) + funn(a + 2, 0) + funn(a + 3, 0)
End if
End if
return a + b
End function funn()
A. 17
B. 21
C. 20
D. 8
Q.8
What will be the output of the following pseudocode?
Integer count
for (each count from 0 to 9)
print "#"
if (count > 6)
CONTINUE
print count
End for
A. #0#1#2#3#4#5#
B. #0#1#2#3#4#5#6##
C. #0#1#2#3#4#5#6
D. #0#1#2#3#4#5#6#7#8#9#10
Q.9
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
Q.10
Tree is a binary search tree. Which of the following code will help us to find the minimum
element of Tree?
Q.11
below is a pseudo code
Set x = 1
Set n = 200
while(n>100):
x=x-n
n=n-5
end while
Write x
A. -3049
B. -3048
C. -3047
D. -3059
Q.12
Below is a pseudo-code
Set x = 0;
Set y = 1;
Set n = 0
print(0)
print(1)
while(n<10-2):
Set z=x+y
Swap x, y with y, z
Write z
Increment of n by 1
In which series is the output
A. Fibonacci Series
B. Tribonacci Series
C. Triangular Series
D. Arithmetic Series
Q.13
What will be the output of the following pseudocode?
Integer x,y,z
Set x=3
Set y=90
while(y is greater than 0);
y=y/3
x=x+6
c=x+y
while(c is greater than 30):
if(c mod 3 is equals to 0):
Write x
else:
Write y
c=c/5
Write c
A. 9, 33
B. 9, 30
C. 9, 36, 9
D. 9, 33, 6
Q.14
What will be the output of the following pseudocode?
int main()
{
integer num;
for(num equals to 80; num!=0; num++)
Write num++
getchar();
return 0;
}
A. Error
B. 140
C. Infinite Loop
D. None of these
Q.15
Consider the following given algorithm and identify the task performed by this
int main()
{
int n = 1;
do
{
printf("%d", n);
n--;
if (n > 15)
continue;
} while (0);
return 0;
}
A. 15
B. 1
C. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
D. Run Time Error
Q.16
What will be the output of the following pseudocode?
#include <stdio.h>
using namespace std;
int main()
{
printf("%d", 'X' > 'x');
return 0;
}
A. 0
B. X
C. x
D. 1
Q.17
What will be the output of the following pseudocode?
#include <stdio.h>
using namespace std;
int main()
{
for (int x = 10; x >= 0; x--) {
int z = x & (x >> 1);
if (z)
printf("%d ", x);
}
}
A. 127
B. 10 9 8
C. 763
D. 963
Q.18
What will be the output of the following pseudocode?
#include <stdio.h>
int main()
{
int x = 10, y = 20, z = 30;
z = x = y;
printf("%d", z);
return 0;
}
A. 10
B. 30
C. Error
D. 20
Q.19
What will be the output of the following pseudocode?
#include <stdio.h>
int main()
{
int x = 210;
int y = 0;
;
;
printf("%d", y);
;
;
return 0;
}
A. 0
B. 210
C. Run Time Error
D. Compile Time Error
Q.20
What will be the output of the following pseudocode for the given set of input?
#include <stdio.h>
void main()
{
int a = 1.0, b = 2, c = 3.12;
char d = 0.0;
if (a, b, c, d)
{
printf("KHUDSOLVEKRO");
}
}
A. No Output
B. Error
C. KHUDSOLVEKRO
D. 1.0
Q.21
Which is not an objective of network security?
A. Identification
B. Authentication
C. lock
D. Access Control
Q.22
_________ computing refers to applications and services that run on a
distributed network using virtualized resources.
A. Distributed
B. Cloud
C. Soft
D. Parallel
Q.23
What will be the output of the pseudocode?
#include <stdio.h>
void main()
{
int a = 100;
printf("%0 %x", a);
}
A. %x
B. a
C. 100
D. %0
Q.24
Observe the code carefully and choose the correct output of this code.
#include <stdio.h>
int main()
{
typedef int score;
score result = 0.00;
printf("%d", result);
return 0;
}
A. 0.0
B. 0.00
C. 0.000000
D. 0
Q.25
Observe the code carefully and choose the correct output of this code.
#include <stdio.h>
int main(){
float m = 0.0;
long int n = 10;
printf("%d", sizeof(m) == sizeof(m+n));
return 0;
}
A. 10
B. 10.0
C. 10+0.0
D. 0 (Zero)
Q.26
What will be the output of following pseudo code?
#include <stdio.h>
int main()
{
int any = ' ' * 10;
printf("%d", any);
return 0;
}
A. 10
B. 120
C. 320
D. 160
Q.27
Observe the code carefully and choose the correct output of this code.
#include <stdio.h>
int main()
{
int tell = 5.0, scl = 1*10;
do {
scl /= tell;
} while(tell--);
printf ("%d\n", scl);
return 0;
}
A. Floating point exception
B. 10
C. 5.0
D. 10.0
Q.28
What will be the output of the following c code?
#include <stdio.h>
int main()
{
int b = 80;
char a= (char)b;
int i=sizeof(a);
printf("%d",i);
}
A. 1
B. 80
C. 2
D. 1
Q.29
what will be the output of following c code?
#include <stdio.h>
int main()
{
printf("%f", main);
return 0;
}
A. 0
B. 0.000
C. 0.00000
D. 0.000000
Q.30
What will be the output of the following pseudo-code for input 7 ?
1. Read the value of N.
2. Set m=1,T=0
3. If m >N
4. Go to line No. 9
5. Else
6. T= T+m
7. m=m+1
8. Go to line no.3
9. Display the value of T
10.Stop
A. 28
B. 32
C. 56
D. 76
Q.31
what will be the output of the following pseudocode?
Set fun = 5
Set goal = 8
Set sum1 = 0
Set n = 2
if (goal is greater than fun):
for(n=fun; n<goal; n=n+1)
sum1=sum1+n
else:
Write Error messages
Write sum1
A. 18
B. 15
C. 9
D. 6
Q.32
what will be the output of the following pseudocode?
#include<stdio.h>
int main()
{
for(printf("NoError"));
}
A. Compiler Error
B. NoError will get printed 7 times
C. It will not print anything
D. NoError will get printed 6 times
Q.33
what will be the output of the following pseudocode?
#include<stdio.h>
int main()
{
fprintf(stdout,"Get Placed");
}
A. Error
B. Garbage values
C. Get placed
D. Nothing gets printed
Q.34
what will be the output of the following pseudocode?
#include<stdio.h>
int main()
{
int date = 100;
const int timeof = date;
printf("%f", timeof);
}
A. Nothing gets printed
B. Error
C. 100.000000
D. 0.000000
Q.35
Predict the output
#include<stdio.h>
int main()
{
printf("%nxy");
printf("%bxy");
printf("%rxy");
}
A. Nothing gets printed
B. Error
C. xy%bxy%rxy%
D. %nxy%bxy%rxy
Q.36
What will be the output of the following code
#include<stdio.h>
int main()
{
int i = 065,j = 65;
printf("%d,%f",i,j);
}
A. 065,65
B. 53,0.000000
C. 65,65
D. Error
Q.37
Read the code carefully and answer what will be the output:
#include <stdio.h>
int main()
{
int p,q=105;
p=printf("%d",q);
printf("%d",p);
}
A. 105 4
B. 105 3
C. Error
D. 3
Q.38
Read the code carefully and answer what will be the output:
#include <stdio.h>
int main()
{
int k=25;
if (printf("%d",k))
printf("%d",k);
else
printf(“Fiat Mock");
}
A. Fiat Mock
B. 25 25
C. Value error
D. 2525
Q.39
Read the code carefully and answer what will be the output:
#include <stdio.h>
int main()
{
int p=3;
switch(p)
{
case 1:
printf(“Fiat\n");
break;
case 2:
printf("Hello world\n");
case 3:
continue;
case 4:
printf("Capgemini\n"); break;
}
}
A. Infinite loop
B. Error
C. Fiat
D. Fiat Hello world Capgemini
Q.40
Predict the output
Declare variable x, y and i
Set x =0 and y =1
for(int i=1; i<=4; i=i+1)
print x
x=x+y
y=x/y
End of loop
A. 1024
B. 0138
C. 0124
D. 0123
Q.41
For the construction of a binary heap with the property that parent node has value less than child node.In reference to that which line is incorrect. Line indexed
from 1.

1. add(int k)

2. {

3. heap_size++;

4. int i = heap_size - 1;

5. harr[i] = k;

6. while (i != 0 && harr[parent(i)] < harr[i])

7. {

8. swap(&harr[i], &harr[parent(i)]);

9. i = parent(i);

10. }

11. }

A. Line-3

B. Line-5

C. Line-6

D. Line-7
Q.42
Given an array of element 5,7,9,1,3,10,8,4. Tick all the correct sequences of
elements after inserting all the elements in a min-heap.
A. 1, 3, 4, 5, ,7, 8, 9, 10
B. 1, 4, 3, 8, 9, 5, 7, 10
C. 1, 3, 4, 5, 8, 7, 9, 10
D. None of these
Q.43
Given the code, choose the correct option that is consistent with the code. (Here A is the
heap)
build(A,i)
left-> 2*i
right->2*i +1
temp- > i
if(left<= heap_length[A] ans A[left] >A[temp])
temp -> left
if (right = heap_length[A] and A[right] > A[temp])
temp->right
if temp!= i
swap(A[i],A[temp])
build(A,temp)
A. It is the build function of the max heap
B. It is the build function of min heap
C. It is general build function of any heap
D. None of the above
Q.44
Advantages of linked list representation of binary trees over arrays?
A. dynamic size
B. ease of insertion/deletion
C. ease in randomly accessing a node
D. both dynamic size and ease of insertion/deletion
Q.45
What is the code below trying to print?

void print(tree *root,tree *node)

if(root ==null) return 0

if(root-->left==node || root-->right==node || print(root->left,node)||printf(root->right,node)

print(root->data)

}
A. Just Printing all nodes
B. Not a valid logic to do any task
C. Printing ancestors of a node passed as the argument
D. Printing nodes from the leaf node to node passed as the argument
Q.46
The following lines talk about deleting a node in a binary tree.(the tree
property must not be violated after deletion)
i) from root search for the node to be deleted
ii)
iii) delete the node at
what must be statement ii) and fill up statement iii)
A. i)Find random node, replace with the node to be deleted. iii) delete the
node
B. ii) find deepest node, replace with the node to be deleted iii) delete a node
C. ii) find node to be deleted. Iii) delete the node at the found location
D. ii) find the deepest node, replace with the node to be deleted. iii) the
deepest node
Q.47
Given 10,8,6,7,9
swap the above numbers such that finally you got 6,7,8,9,10
so now reverse 10
9,7,6,8,10
now reverse 9
8,6,7,9,10
7,6,8,9,10
6,7,8,9,10
at this point 6 is ahead so no more reversing can be done so stop.
To implement above algorithm which data structure is better and why ?
A. linked list. because we can swap elements easily
B. arrays. because we can swap elements easily
C. xor linked list. because there is no overhead of pointers and so memory is saved
D. doubly linked list. because you can traverse back and forth
Q.48
What does first and last nodes of a xor linked lists contain ? (let address of
first and last be A and B)
A. NULL xor A and B xor NULL
B. NULL and NULL
C. A and B
D. NULL xor A and B
Q.49
How many steps will be taken to construct a B-Tree with the following
elements:-

[20 , 30 , 35 , 85 , 5 , 10 , 40 , 55 , 60 , 38 , 25 , 7 , 78].
A. 12
B. 13
C. 14
D. 15
Q.50
Which of the following operations are performed in a binary search tree?
A. Insertion, Deletion
B. Insertion, Deletion, rotation
C. Insertion, Deletion, Travesrsal
D. All
Q.51
The properties of a BST include:-
A. values of nodes (left subtree)<value(root node)
B. values of nodes (right subtree)<value(root node)
C. values of nodes (left subtree)=values of nodes (right subtree)
D. a and b
Q.52
The direction of traversal for preorder is
A. anti-clockwise
B. clockwise
C. sequential
D. b and c
Q.53
The order of traversal in preorder, postorder and inorder includes:-
A. inorder: root, left, right. Preorder: left, root, right. postorder: left, right,
root
B. inorder: left, right, root. Preorder: root, left, right. postorder: left, root,
right
C. inorder: left, root, right. Preorder: root, left, right. postorder: left, right,
root
D. inorder: root, left, right. Preorder: left, right, root. postorder: left, right,
root
Q.54
Using which of the following traversals, we cannot construct a tree?
A. preorder, postorder
B. Preorder, inorder
C. Postorder, inorder
D. All
Q.55
Which of the following tree data structures is not a balanced binary tree?
A. AVL tree
B. B-tree
C. Red black tree
D. Splay tree
Q.56
Q.57
The representation of a binary tree can be in the form of:-
A. only sequential representation
B. only Dynamic node representation
C. arrays and linked lists
D. none
Q.58
A binary tree is called a Perfect Binary Tree if:-

A. all the internal nodes have exactly 2 children.


B. all the internal nodes have at most 2 children.
C. all the internal nodes have at least 2 children.
D. b and c
Q.59
Which among the following is true about Queues?

i:)These are abstract data structures


ii:)These follows the FIFO order
iii.)Insertion and deletion is performed at one end only
A. i and ii
B. ii and iii
C. i and iii
D. i,ii,iii
Q.60
Queues in the application areas are implied as the __________
A. templates parameters
B. member types
C. container adaptors
D. functions
Q.61
Different types of Queues are
A. circular queue
B. priority queue
C. doubly ended queue
D. all of the above
Q.62
To implement a stack,how many ques are required?
A. 1
B. 2
C. 3
D. 4
Q.63
The Priority queue of pairs can have two types of ordering –
A. Ordered by the first element of pair
B. Ordered by the second element of pair
C. Either a and b
D. Both a and b
Q.64
Which among the following is an application of queue?

i:)Flood Fill Algorithm

ii:)Chess Knight Problem

iii:)Shortest path in a maze


A. I & II
B. II & III
C. I & III
D. I, II & III
Q.65
Priority Queue is the extension of the queue comprising the features.

1. Each object has its related priority.


2. The high priority element is dequeued from the low priority element.
3. If two elements have the same priority, any of them are executed

A. i and ii
B. ii and iii
C. i and iii
D. i,ii,iii
Q.66
A[i][j]=1 in adjacency matrix depicts that
A. there is an edge from vertex i to vertex j
B. there is an edge from vertex j to vertex i
C. binary matrix contains all the cell values as one
D. this sparse matrix contains all the cell values as one
Q.67
An adjacency matrix can have 0 or 1 values and can be modified as
weighted matrix:-
A. if all the cell values store A[i][j]=0
B. if all the cell values store A[i][j]=1
C. if all the cell values store A[i][j]=weight of edge
D. It cannot be modified as a weighted matrix
Q.68
Adjacency matrix provides -----------------------to determine if there is an
edge between two nodes.
A. constant time access (O(n) )
B. constant space access (O(n) )
C. constant space access (O(1) )
D. constant time access (O(1) )
Q.69
Select the correct option
A. A sparse matrix - most of the elements are zero, whereas a dense
matrix- most of the elements are non-zero.
B. A sparse matrix - most of the elements are non-zero, whereas a dense
matrix- most of the elements are zero.
C. A sparse matrix - all of the elements are zero, whereas a dense
matrix- most of the elements are one.
D. A sparse matrix - all of the elements are one, whereas a dense matrix-
most of the elements are zero.
Q.70
What is the condition for an isolated node?
A. degree of edge=0
B. degree of edge=1
C. degree of node=1
D. degree of node=0
Q.71
When you passed an array as an argument to the function then what
does it mean ?
A. Base address of the array
B. Base address of the array of first element
C. Base address of the array of last element
D. Address of the array
Q.72
Assume that float takes 4 bytes, Predict the output
#include <stdio.h>
int main()
{
float arr[5] = {12.5, 10.0, 13.5, 90.5, 0.5};
float *ptr1 = &arr[0];
float *ptr2 = ptr1 + 3;
printf("%f ", *ptr2);
printf("%d", ptr2 - ptr1);
return 0;
}
Q.73
A pointer to a block of memory is effectively same as an array.
A. Yes
B. No
C. Depends
D. None
Q.74
Which of the following concepts make extensive use of arrays?
A. Binary trees
B. Scheduling of processes
C. Caching
D. Spatial locality
Q.75
One of the header fields in an IP datagram is the Time to Live (TTL) field.
Which of the following statements best explains the need for this field?
A. It can be used to priortize packets
B. It can be used to reduce delays
C. It can be used to optimize throughput
D. It can be used to prevent packet looping

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy