-
Notifications
You must be signed in to change notification settings - Fork 1
/
CAPGEMINI SET 2.txt
292 lines (192 loc) · 4.6 KB
/
CAPGEMINI SET 2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
Find the output of the following pseudo-code:
Integer x,y,z;
x=0
y=1
x = y = z = 8
Print x
Options:
A) 0
B) 8
C) 1
D) None of the above
---------------------------------------------------
Question 2:
Find the output of the following pseudo-code:
Integer value, n
Set value = 1, n = 45while(value less than equal to n)
value = value << 1
end loop
Print value
Options:
A) 64
B) 32
C) 45
D) None of the above
---------------------------------------------------------
Find the output of the following pseudo-code:
Integer c, d
Set c = 15, d = 12
d = c – 1
Print c //line
c = d + (c – 2)
if(c < 40)
Goto line
end if
Options:
A) 14 26 38
B) 27 39
C) 15 27 39
D) None of the above
-----------------------------------------------------
Find the output of the following pseudo-code if x= 4 and y=5:
Integer fun(int x, int y)
if(x > 1)
fun(x – 2, y + 2)
end if
print y
End function fun()
Options:
A) 4 5 6
B) 7 6 5
C) 9 7 5
D) None of the above
-----------------------------------------------------
How many times will the print statement be executed:
Integer a, b, c
Set a = 8, b = 10, c = 6
If(a > c AND (b + c) > a)
Print a
end ifif(c > b OR (a + c) > b)
Print b
end ifif((b+c) MOD a EQUALS 0)
Print c
end if
Options:
A) 2
B) 3
C) 1
D) 0
------------------------------------------------------------
What will be the output if the following pseudocode if a=10 and b=6:
Integer func (Integer a, Integer b)
Integer temp
while(b)
temp = a MOD b
a = b
b = temp
end whilereturn a
End function func()
Options:
A) 2
B) 4
C) 3
D) 1
--------------------------------------------------------
What will be the output of the following pseudo-code?
Integer x, y, z
Set x=24, y=8
x = x/y
z = y<<x
Print z
[Note: << is left shift operator, it takes two numbers, left shifts the bits of the first operand, the second operand decodes the number of …]
Options:
A) 1
B) 8
C) 0
D) 64
--------------------------------------------------------------
What will be the output of the following pseudocode?
Integer x, y, z, a
Set x = 2, y = 1, z = 5
a = (x AND y) OR (z + 1)
Print a
Options:
A) 5
B) 3
C) 2
D) 1
------------------------------------------------------------
02:19
What will be the output of the following pseudocode?
Integer a=5, b=4, c=3
a = b + c
c = a – b
c = c + a
c = b + c
b = b + c
Print a, b, c
Options:
A) 7 14 7
B) 7 14 10
C) 7 8 14
D) 7 18 14
-------------------------------
What will be the output of the following pseudocode?
Integer a, b, c, d
Set b = 18, c = 12
a = b – c
for (each c from 1 to a – 1)
b = b + c + 12
b = b/5
d = b + a
end for
c = a + b + c
Print a b c
Options:
A) 5 3 9
B) 6 14 17
C) 6 4 14
D) 6 4 16
--------------------------------------------------------
An abstract data type is defined to be a mathematical model of a user-defined type along with the collection of all ________ operations on that model.
Options:
A) Union
B) Assignment
C) Primitive
D) None of the above
-------------------------------------------------------
What do we call the binary tree nodes with no successor?
Options:
A) End nodes
B) Terminal nodes
C) Last nodes
D) Final nodes
-----------------------------------------------------
What do we call the highest element of an array’s index?
A) Upper bound
B) Lower bound
C) Range
D) Extraction
----------------------------------------------------
Which of the following data types represents many to many relations?
A) Both plex and graph
B) Graph
C) Plex
D) Tree
--------------------------------------------------------
Which of the following is NOT a type of linked list?
A) Double ended linked list
B) Double linked list
C) Simple linked list
D) Circular linked list
-----------------------------------------------------
Each node of the graph is represented as a _______?
A) Vertex
B) Root
C) Path
D) Edge
------------------------------------------------------
Recursion uses more memory space than iteration. Which of the following is/are the valid reason for the same?
A. It uses the stack instead of a queue
B. Every recursion call has to be stored
Choose the correct answer from the options given below.
A) Only A
B) Both A and B
C) Neither A nor B
D) Only B
------------------------------------------------------------
To which of the following domain problem does the knapsack problem belong?
A) NP-complete
B) Sorting
C) Optimisation
D) Linear Solution