Sunteți pe pagina 1din 11

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

GS Engineers Campus Hiring Program

01h : 59m to test end

 Register calculations

- Programming

-

Consider four concurrent processes P1, P2, P3 and P4 as shown below, which access a shared

variable V that has been initialized to 200.

 1 P1: 2 V = V + 30

- Problem

Solving -

 3 P2: 4 5 V = V - 60 6 7 P3: 8 V = V + 40 9 10 P4: 11 12 V = V + 20

13

The Processes are executed on a single processor system running a time-shared operating system.

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m to test end

Pick one of the choices

 0 - Programming - 90 1 100 150 2 none of the above

- Problem

Solving -

13

Clear selection

Evaluate Sum

Consider the following pseudocode where x is an integer variable initialized to a non negative integer value.

// x is a non negative integer int sum

x <- x/2 // integer division; truncates fractions for (sum <- 1; x > 0; x <- x/2 ) sum <- sum + 1 end for

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

Pick one of the choices

int sum <- 0

x <- x/2

while (x >= 0)

sum <- sum + 1

x <- x/2

end while

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

GS Engineers Campus Hiring Program

01h : 59m to test end

sum <- sum + 1

x <- x/2

end while

- Programming

-

int sum <- 0

do {

sum <- sum + 1

 1 x <- x/2 } while (x>0) 2 int sum <- 1

- Problem

Solving -

do {

sum <- sum + 1

 3 x <- x/2 } while (x>0) 4 None of the above 5 Clear selection 6 7 Relational Database 8 A relational database contains two tables PersonDetails and MovieWatched as shown below: 9 PersonDetails: 10 ID Name Age 1 Samyra 8 11 2 Tanvi 12 12 3 Vinay 28 - Advanced - 4 Prasad 42 13 5 Shanu 53 - Tell us about

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m to test end

 ID Language NumberOfMovies Hindi 2 10 - Programming 2 English 25 - 1 3 French 3 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 6 SELECT P.Name , sum(M.NumberOfMovies) FROM PersonDetails P, MovieWatched M WHERE M.NumberOfMovies > 5 7 GROUP BY P.Name; 8 How many number of rows will the above query return? 9 Pick one of the choices 10 2 3 11 4 12 5 none of the above

13

Clear selection

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m 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

-

 1 Pick one of the choices 6.12 2 6.76 - Problem 7.4 Solving - 5.76 3 None of the above 4 Clear selection 5 6 Sequence in rolling of dice 7 If you roll a 10-sided dice 3 mes, what is the probability that they form neither a strictly increasing nor a strictly decreasing series? 8 9 Pick one of the choices 10 0.76 11 0.64 0.82 12 0.56 None of the above

13

Clear selection

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m 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?

- Programming

-

Note: In answer op ons below

y

C

x

is represented as y_C_x

 1 Pick one of the choices 26_C_13 - 26_C_14 2 24_C_12 - 24_C_13

- Problem

Solving -

22_C_11 - 22_C_12

20_C_10 - 20_C_11

 3 none of the above 4 Clear selection 5 6 Cats on cliffs 7 On a cliﬀ of length 110m at a height 240m, 10 cats are posi oned facing either the le or right direc on arbitrarily. The length of the cliﬀ 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 reverse their respec ve direc ons and con nue running. When a cat reaches the ends of the cliﬀ, it falls down. 8 9 On average, how much me does it take for all 10 cats to fall oﬀ the cliﬀ? 10 Pick one of the choices 11 8 sec 10 sec 12 9 sec - Advanced - 11 sec 13 None of the above

Clear selection

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m to test end

- Programming

-

 1 2 Evaluate Time complexity for For loop

- Problem

Solving -

int fun(int n){

int count=0; for(int i = n;i>0; i/=2) for(int j=0; j < i ; j++) count += 1; return count;

}

What is the run time complexity of the above code?

Pick one of the choices

O(n )

O(n log n)

O(n)

O(n log(log n))

None of the above

Clear selection

2

Main Function Return

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m to test end

return f(a, b) * (*a);

}

int main() { int a = 3;

int b = 3;

- Programming

-

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 6 7 Adjacency matrix 8 Given the following program, what will be the 4th number that’d get printed in the output sequence for the given input? 9 10 #include using namespace std; int cur=0; int matrix[12][12]; bool visited[12]; deque queue; void function(int n); 11 12 - Advanced - int main() 13 { - Tell us about

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

GS Engineers Campus Hiring Program
01h : 59m
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++)
visited[i]=false;
-
Programming
-
function(n);
return 0;
1
}
2
void function(int n)
{
- Problem
Solving -
cout<<cur<<" ";
visited[cur]=true;
queue.push_back(cur);
3
do
{
4
for(int j=0;j<n;j++)
{
if(matrix[cur][j]==1 && !visited[j])
5
{
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
Input Sequence -
11
11
0
0 0 1 0 0 0 0 0
12
0
1 0 0 0 0 0 0 1
0
0
1
1
1 0
0 0 1
0
0 1 0 0 0 0 0 0
13
0
0 1 0 0 0 0 1 0

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m to test end

0 1 0 0 0 1 0 0

1

0 1 0 0 1 0

1 0 1

0 0 0 1 0 0 0 0

0

- Programming

Pick one of the choices

 - 2 1 6 2 8 5 - Problem Solving - None of the above
Clear selection
3
4
5
6
7
8
9
10
11
12

13

GS Engineers Campus Hiring Program

https://www.hackerrank.com/tests/f37q7ef02fc/questions/ggdc7a7fth8

01h : 59m to test end

- Programming

-

1
2

- Problem

Solving -