Sie sind auf Seite 1von 11

GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.

com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
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
- Programming variable V that has been initialized to 200.
-
 
1 P1:
..
..
2
V = V + 30
- Problem
..
Solving -
..
3  
P2:
4 ..
..
5 V = V - 60
..
6 ..
 
P3:
7
..
..
8
V = V + 40
..
9
..
 
10
P4:
..
11
..
V = V + 20
12
..
- Advanced - ..
 
13
The Processes are executed on a single processor system running a time-shared operating system.
- Tell us about

1 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

Pick one of the choices


0
- Programming
- 90

1 100

150
2
none of the above
- Problem
Clear selection
Solving -

4 Evaluate Sum

5 Consider the following pseudocode where x is an integer variable initialized to a non negative
integer value.
6
// x is a non negative integer
int sum
7 x <- x/2 // integer division; truncates fractions
for (sum <- 1; x > 0; x <- x/2 )
8 sum <- sum + 1
end for

 Which of the following will calculate the same value of sum as the fragment above?
10

Pick one of the choices


11
int sum <- 0
x <- x/2
12
while (x >= 0)
- Advanced -     sum <- sum + 1
    x <- x/2
13 end while
- Tell us about
_________________________________________________________

2 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

    sum <- sum + 1


    x <- x/2
end while
_________________________________________________________
int sum <- 0
- Programming
do {
-
    sum <- sum + 1
1     x <- x/2
} while (x>0)
_________________________________________________________
2
int sum <- 1
- Problem do {
Solving -
    sum <- sum + 1
    x <- x/2
3
} while (x>0)
_________________________________________________________
4
None of the above
Clear selection
5

Relational Database
7

8
A relational database contains two tables PersonDetails and MovieWatched as shown below:
 
PersonDetails:
9
ID Name Age
10
1 Samyra 8

11
2 Tanvi 12

12 3 Vinay 28

- Advanced -
4 Prasad 42
13
5 Shanu 53
- Tell us about

3 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

ID Language NumberOfMovies

2 Hindi 10

- Programming
2 English 25
-
3 French 3
1
5 English 35
2
5 Spanish 10
- Problem
Solving - 5 Hindi 20

3  
 
4 The Primary key of the PersonDetails table is ID. For MovieWatched ID and Language together
form the primary key. Consider the SQL query given below:
 
5
SELECT P.Name , sum(M.NumberOfMovies)
FROM PersonDetails P, MovieWatched M
6
WHERE M.NumberOfMovies > 5
GROUP BY P.Name;
7
 
How many number of rows will the above query return?
8
 

9
Pick one of the choices

10 2

3
11
4

5
12
none of the above
- Advanced -
Clear selection
13

- Tell us about

4 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

On a given day, the weather can be sunny (probability = 0.4), cloudy (probability = 0.4) or rainy (probability =
0.2). Weather is independent across days. Blocks of weather are groups of consecu ve days in which the
weather is the same. Across a ten-day period, what’s the expected number of blocks of iden cal weather?

- Programming
-
Pick one of the choices
1
6.12

2 6.76

- Problem 7.4
Solving -
5.76
3 None of the above
Clear selection
4

5
Sequence in rolling of dice
6

If you roll a 10-sided dice 3 mes, what is the probability that they form neither a strictly increasing nor a strictly
7
decreasing series?

9
Pick one of the choices
10 0.76

0.64
11
0.82

12 0.56

None of the above


- Advanced -
Clear selection
13

- Tell us about

5 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

In how many ways can a convex polygon with 12 sides cut into triangles by connec ng ver ces with non-
crossing line segments?
 
Note: In answer op ons below yCx is represented as y_C_x
- Programming
-
Pick one of the choices
1
26_C_13 - 26_C_14

2 24_C_12 - 24_C_13

- Problem 22_C_11 - 22_C_12


Solving -
20_C_10 - 20_C_11
3 none of the above
Clear selection
4

5
Cats on cliffs
6

On a cliff of length 110m at a height 240m, 10 cats are posi oned facing either the le or right direc on
7
arbitrarily. The length of the cliff is large compared to the size of each cat. Ini ally, all cats start running in the
direc on they are facing at a speed 12m/sec. Whenever any cat collides with another cat, both the cats instantly
8
reverse their respec ve direc ons and con nue running. When a cat reaches the ends of the cliff, it falls down.
 
9
On average, how much me does it take for all 10 cats to fall off the cliff?

10
Pick one of the choices

11 8 sec

10 sec
12
9 sec
- Advanced -
11 sec

13 None of the above

- Tell us about Clear selection

6 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

- Programming
-

2 Evaluate Time complexity for For loop


- Problem
Solving -
int fun(int n){
3 int count=0;
for(int i = n;i>0; i/=2)
for(int j=0; j < i ; j++)
4
count += 1;
return count;
5 }

6 What is the run time complexity of the above code?

7 Pick one of the choices


O(n2)
8
O(n log n)
O(n)
9
O(n log(log n))
None of the above
10
Clear selection

11

12

- Advanced -
Main Function Return
13
int f(int* a, int b) {
- Tell us about

7 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end
    *a = *a + 1; // '*a' accesses the value pointed to by pointer 'a'
    return f(a, b) * (*a);
}
int main() {
    int a = 3;
- Programming     int b = 3;
-
    return f(&a, b);

1 }

2 Pick one of the choices


- Problem 20
Solving - 25

3 30
120
4 none of the above
Clear selection
5

Adjacency matrix
7

Given the following program, what will be the 4th number that’d get printed in the output
8
sequence for the given input?
 
9

#include <bits/stdc++.h>
10 using namespace std;
int cur=0;
int matrix[12][12];
11
bool visited[12];
deque <int> queue;
12
void function(int n);
- Advanced -
int main()
13 {

- Tell us about

8 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cin>>matrix[i][j];

for(int i=0;i<n;i++)
- Programming
visited[i]=false;
-
function(n);
return 0;
1
}

2 void function(int n)
{
- Problem cout<<cur<<" ";
Solving - visited[cur]=true;
queue.push_back(cur);
3
do
{
4
for(int j=0;j<n;j++)
{
5 if(matrix[cur][j]==1 && !visited[j])
{
queue.push_back(j);
6 cout<<j<<" ";
visited[j]=true;
}
7

}
8
queue.pop_front();
if(!queue.empty())
9 cur=queue.front();
}while(!queue.empty());
10 }

11 Input Sequence - 
11 
12 000100000  
0 1 0 0 0 0 0 0 1 
- Advanced -
0 0 1 1 1 0 0 0 1 
13 0 0 1 0 0 0 0 0 0 
0 0 1 0 0 0 0 1 0 
- Tell us about

9 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

101000100
010010101
000010000

- Programming Pick one of the choices


-
2
1 6

8
2
5
- Problem
Solving - None of the above
Clear selection
3

10

11

12

- Advanced -

13

- Tell us about

10 of 11 18-Aug-19, 11:04 AM
GS Engineers Campus Hiring Program :: powered by HackerRank https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

 
 01h : 59m
GS Engineers Campus Hiring Program
to test end

- Programming
-

- Problem
Solving -

10

11

12

- Advanced -

13

- Tell us about

11 of 11 18-Aug-19, 11:04 AM

Das könnte Ihnen auch gefallen