Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
01h : 51m
GS Engineers Campus Hiring Program
to test end
Register calculations
Consider four concurrent processes P1, P2, P3 and P4 as shown below, which access a shared
- variable V that has been initialized to 200.
Programmin
-
P1:
1 ..
..
2 V = V + 30
..
- Problem
Solving -
..
3 P2:
..
4 ..
V = V - 60
5 ..
..
6
P3:
7 ..
..
8 V = V + 40
..
9 ..
10 P4:
..
11 ..
V = V + 20
12 ..
..
- Advanced
-
The Processes are executed on a single processor system running a time-shared operating
13 system. If minimum and maximum possible values of V after the four processes have
- Tell us
completed execution are X and Y respectively, then the value of Y - X is ?
about
yourself - Pick one of the choices
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 1/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
0 01h : 51m
GS Engineers Campus Hiring Program
to test end
90
100
150
none of the above
- Clear selection
Programmin
-
1
Evaluate Sum
2
- Problem
Consider the following pseudocode where x is an integer variable initialized to a non
Solving - negative integer value.
6
Which of the following will calculate the same value of sum as the fragment above?
7
Pick one of the choices
8 int sum <- 0
x <- x/2
9 while (x >= 0)
sum <- sum + 1
10 x <- x/2
end while
_________________________________________________________
11
int sum <- 1
x <- x/2
12
while (x >= 0)
- Advanced sum <- sum + 1
- x <- x/2
end while
13
_________________________________________________________
- Tell us
about
yourself -
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 2/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
3
Relational Database
4
A relational database contains two tables PersonDetails and MovieWatched as shown below:
5
PersonDetails:
6 ID Name Age
7 1 Samyra 8
2 Tanvi 12
8
3 Vinay 28
9
4 Prasad 42
10
5 Shanu 53
11
12 MovieWatched
2 Hindi 10
13
- Tell us
2 English 25
about
yourself - 3 French 3
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 3/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
5 English 35Program 01h : 51m
GS Engineers Campus Hiring
to test end
5 Spanish 10
5 Hindi 20
-
The Primary key of the PersonDetails table is ID. For MovieWatched ID and Language
Programmin
together form the primary key. Consider the SQL query given below:
-
1 SELECT P.Name , sum(M.NumberOfMovies)
FROM PersonDetails P, MovieWatched M
2 WHERE M.NumberOfMovies > 5
- Problem
GROUP BY P.Name;
Solving -
How many number of rows will the above query return?
3
4
Pick one of the choices
5 2
3
6
4
7 5
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 4/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
6.76
01h : 51m
GS Engineers Campus Hiring Program
7.4 to test end
5.76
None of the above
Clear selection
-
Programmin
If you roll a 10-sided dice 3 times, what is the probability that they form neither a strictly increasing
2
nor a strictly decreasing series?
- Problem
Solving -
3
Pick one of the choices
4
0.76
5 0.64
0.82
6
0.56
9
Triangles in Convex polygon
10
In how many ways can a convex polygon with 12 sides cut into triangles by connecting vertices with
11 non-crossing line segments?
12 Note: In answer options below yCx is represented as y_C_x
- Advanced
- Pick one of the choices
13 26_C_13 - 26_C_14
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 5/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
22_C_11 - 22_C_12
01h : 51m
GS Engineers Campus Hiring Program
20_C_10 - 20_C_11 to test end
-
Programmin Cats on cliffs
-
1 On a cliff of length 110m at a height 240m, 10 cats are positioned facing either the left or right
direction arbitrarily. The length of the cliff is large compared to the size of each cat. Initially, all cats
2 start running in the direction they are facing at a speed 12m/sec. Whenever any cat collides with
- Problem
another cat, both the cats instantly reverse their respective directions and continue running. When a
Solving - cat reaches the ends of the cliff, it falls down.
3
On average, how much time does it take for all 10 cats to fall off the cliff?
4
Pick one of the choices
5 8 sec
10 sec
6
9 sec
7 11 sec
10
Evaluate Time complexity for For loop
11
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 6/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
O(n log n)
O(n)
2
Main Function Return
- Problem
int f(int* a, int b) {
Solving -
b = b - 1;
3 if (b == 0) return 1;
*a = *a + 1; // '*a' accesses the value pointed to by pointer 'a'
4 return f(a, b) * (*a);
}
5 int main() {
int a = 3;
6
int b = 3;
return f(&a, b);
7
}
8
Pick one of the choices
9 20
25
10 30
120
11
none of the above
Clear selection
12
- Advanced
-
13
Adjacency matrix
- Tell us
about
yourself -
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 7/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
Given the following program, what will be the 4th number that’d the output
01hget printed in
: 51m
GSsequence
Engineersfor
Campus Hiringinput?
the given Program
to test end
#include <bits/stdc++.h>
using namespace std;
int cur=0;
int matrix[12][12];
-
bool visited[12];
deque <int> queue;
Programmin
-
void function(int n);
1
int main()
{
2 int num=0;
int n;
- Problem cin>>n;
Solving -
for(int i=0;i<n;i++)
3 for(int j=0;j<n;j++)
cin>>matrix[i][j];
4
for(int i=0;i<n;i++)
visited[i]=false;
5
function(n);
return 0;
6
}
7 void function(int n)
{
cout<<cur<<" ";
8 visited[cur]=true;
queue.push_back(cur);
9
do
{
10 for(int j=0;j<n;j++)
{
if(matrix[cur][j]==1 && !visited[j])
11
{
queue.push_back(j);
12 cout<<j<<" ";
visited[j]=true;
- Advanced }
-
}
13
queue.pop_front();
- Tell us
if(!queue.empty())
about cur=queue.front();
yourself -
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 8/9
18/08/2019 GS Engineers Campus Hiring Program :: powered by HackerRank
}while(!queue.empty());
} 01h : 51m
GS Engineers Campus Hiring Program
to test end
Input Sequence -
11
000100000
0 1 0 0 0 0 0 0 1
-
0 0 1 1 1 0 0 0 1
Programmin 0 0 1 0 0 0 0 0 0
- 0 0 1 0 0 0 0 1 0
0 1 1 0 0 0 1 0 1
1
0 0 0 1 0 0 0 1 0
1 0 0 0 1 0 1 0 0
2
101000100
- Problem 010010101
Solving -
000010000
3
Pick one of the choices
4 2
6
5
8
6 5
Continue
9
10
About Privacy Policy Terms of Service
11
12
- Advanced
-
13
- Tell us
about
yourself -
https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8 9/9