Sunteți pe pagina 1din 11

GS Engineers Campus Hiring Program :: powered by HackerRank

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

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

GS Engineers Campus Hiring Program

GS Engineers Campus Hiring Program 01h : 59m to test end Register calculations - Programming -

01h : 59m to test end

GS Engineers Campus Hiring Program 01h : 59m to test end Register calculations - Programming -
GS Engineers Campus Hiring Program 01h : 59m to test end Register calculations - Programming -
Register calculations
Register calculations

Register calculations

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
1

P1:

2
2

V

= V + 30

- Problem

Solving -

3
3
 

P2:

4
4
5
5

V

= V - 60

6
6
7
7

P3:

8
8

V

= V + 40

9
9
10
10

P4:

11
11
12
12

V

= V + 20

- Advanced -

13
13

- Tell us about

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

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

GS Engineers Campus Hiring Program

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

01h : 59m to test end Pick one of the choices   0 -

01h : 59m to test end

01h : 59m to test end Pick one of the choices   0 - Programming -
Pick one of the choices
Pick one of the choices
Pick one of the choices

Pick one of the choices

 
  0

0

-

Programming

-

- 90

90

1
1
1 100

100

 
  150

150

 
2
2
  2 none of the above

none of the above

- Problem

Solving -

- Advanced -

13
13

Clear selection

Evaluate Sumabove - Problem Solving - - Advanced - 13 Clear selection Consider the following pseudocode where

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?

calculate the same value of sum as the fragment above? Pick one of the choices int

Pick one of the choices

int sum <- 0of sum as the fragment above? Pick one of the choices x <- x/2 while (x

x <- x/2

while (x >= 0)

sum <- sum + 1

x <- x/2

end while

- Tell us about

GS Engineers Campus Hiring Program :: powered by HackerRank

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

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

GS Engineers Campus Hiring Program

GS Engineers Campus Hiring Program 01h : 59m to test end sum <- sum + 1

01h : 59m to test end

GS Engineers Campus Hiring Program 01h : 59m to test end sum <- sum + 1
GS Engineers Campus Hiring Program 01h : 59m to test end sum <- sum + 1

sum <- sum + 1

x <- x/2

end while

- Programming

-

int sum <- 0sum <- sum + 1 x <- x/2 end while - Programming - do { sum

do {

sum <- sum + 1

1
1
 

x

<- x/2

}

while (x>0)

2
2

int sum <- 12

- Problem

Solving -

do {

sum <- sum + 1

3
3
 

x

<- x/2

}

while (x>0)

 
4
4

None of the above4

5
5

Clear selection

6
6
7
7
7 Relational Database  

Relational Database

 
8
8

A relational database contains two tables PersonDetails and MovieWatched as shown below:

9
9

PersonDetails:

 
       
10
10

ID

 

Name

Age

1

Samyra

8

11
11

2

Tanvi

12

12
12

3

Vinay

28

- Advanced -

4

Prasad

42

13
13

5

Shanu

53

-

Tell us about

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

GS Engineers Campus Hiring Program

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

01h : 59m to test end   ID   Language

01h : 59m to test end

01h : 59m to test end   ID   Language NumberOfMovies Hindi
 

ID    Language NumberOfMovies

 

Language

NumberOfMovies

Hindi2   10

2

 

10

-

Programming

2

English

25

-

     
1
1

3

French

3

5

English

35

2
2

5

Spanish

10

- Problem

     

Solving -

5

Hindi

20

3
3
4
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
5
6
6

SELECT P.Name , sum(M.NumberOfMovies) FROM PersonDetails P, MovieWatched M WHERE M.NumberOfMovies > 5

7
7

GROUP BY P.Name;

8
8

How many number of rows will the above query return?

8 How many number of rows will the above query return? 9 Pick one of the
9
9

Pick one of the choices

10
10
10 2

2

3

3

11
11
11 4

4

12
12
12 5

5

none of the above

none of the above

- Advanced -

13
13

- Tell us about

Clear selection

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

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

01h : 59m to test end

01h : 59m to test end On a given day, the weather can be sunny (probability

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 ve days in which the
weather is the same. Across a ten-day period, what’s the expected number of blocks of iden = 0.2). Weather is independent across days. Blocks of weather are groups of consecu ve days cal weather?

- Programming

-

number of blocks of iden cal weather? - Programming - 1 Pick one of the choices
1
1

Pick one of the choices

6.12

6.12

2
2
2 6.76

6.76

- Problem

- Problem 7.4

7.4

Solving -

Solving - 5.76

5.76

3
3
3 None of the above

None of the above

4
4

Clear selection

5
5
6
6
 
Sequence in rolling of dice

Sequence in rolling of dice

 
7
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
8
 
 
9
9

Pick one of the choices

10
10
10 0.76

0.76

11
11
11 0.64

0.64

0.82

0.82

12
12
12 0.56

0.56

None of the above

None of the above

- Advanced -

13
13

- Tell us about

Clear selection

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

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

01h : 59m to test end

01h : 59m to test end In how many ways can a convex polygon with 12

In how many ways can a convex polygon with 12 sides cut into triangles by connec ng ver ces with non- crossing line segments? ng ver ces with non- crossing line segments?
how many ways can a convex polygon with 12 sides cut into triangles by connec ng

- Programming

-

Note: In answer op ons below

y

C

x

is represented as y_C_x

answer op ons below y C x is represented as y_C_x 1 Pick one of the
1
1

Pick one of the choices

26_C_13 - 26_C_141 Pick one of the choices 2 24_C_12 - 24_C_13

2
2

24_C_12 - 24_C_132

- Problem

Solving -

22_C_11 - 22_C_12- 26_C_14 2 24_C_12 - 24_C_13 - Problem Solving - 20_C_10 - 20_C_11 3 none of

20_C_10 - 20_C_1124_C_12 - 24_C_13 - Problem Solving - 22_C_11 - 22_C_12 3 none of the above 4

3
3

none of the above3

4
4

Clear selection

5
5
6
6
6 Cats on cliffs

Cats on cliffs

 
7
7

On a cliff 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 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 reverse their respec ve direc ons and con nue running. When a cat reaches the ends of the cliff, it falls down.

8
8
9
9

On average, how much me does it take for all 10 cats to fall off the cliff?

me does it take for all 10 cats to fall off the cliff? 10 Pick one
10
10

Pick one of the choices

11
11
11 8 sec

8

sec

10 sec

10

sec

12
12
12 9 sec

9

sec

- Advanced -

- Advanced - 11 sec

11

sec

13
13
13 None of the above

None of the above

- Tell us about

Clear selection

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

GS Engineers Campus Hiring Program

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

01h : 59m to test end - Programming - 1 2

01h : 59m to test end

01h : 59m to test end - Programming - 1 2 Evaluate Time complexity for
01h : 59m to test end - Programming - 1 2 Evaluate Time complexity for

- Programming

-

1
1
2
2
2 Evaluate Time complexity for For loop

Evaluate Time complexity for For loop

- Problem

Solving -

- Advanced -

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?

} What is the run time complexity of the above code? Pick one of the choices

Pick one of the choices

O(n )time complexity of the above code? Pick one of the choices O(n log n) O(n) O(n

O(n log n)complexity of the above code? Pick one of the choices O(n ) O(n) O(n log(log n))

O(n)of the above code? Pick one of the choices O(n ) O(n log n) O(n log(log

O(n log(log n))above code? Pick one of the choices O(n ) O(n log n) O(n) None of the

None of the aboveone of the choices O(n ) O(n log n) O(n) O(n log(log n)) Clear selection 2

Clear selection

2

Main Function Returnn) O(n) O(n log(log n)) None of the above Clear selection 2 - 13 Tell us

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

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() {

01h : 59m to test end

01h : 59m to test end return f(a, b) * (*a); } int main() { int

return f(a, b) * (*a);01h : 59m to test end } int main() { int a = 3; int b

}

int main() { int a = 3;01h : 59m to test end return f(a, b) * (*a); } int b = 3;

int b = 3;

- Programming

-

return f(&a, b);

1
1
1
2
2

}

1 2 } Pick one of the choices

Pick one of the choices

- Problem

- Problem 20

20

Solving -

Solving - 25

25

3
3
3 30

30

120

120

4
4
4 none of the above

none of the above

Clear selection

5
5
6
6
7
7
7 Adjacency matrix

Adjacency matrix

8
8

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

9
9
 
10
10
 

#include <bits/stdc++.h> using namespace std; int cur=0; int matrix[12][12]; bool visited[12]; deque <int> queue;

void function(int n);

11
11
12
12

- Advanced -

 
 

int main()

13
13
 

{

-

Tell us about

 

GS Engineers Campus Hiring Program :: powered by HackerRank

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++)
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
- Advanced -
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

- Tell us about

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

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

01h : 59m to test end

01h : 59m to test end 0 1 0 0 0 1 0 0 1 0

0 1 0 0 0 1 0 0 01h : 59m to test end 1 0 1 0 0 1 0 1 0 1

1

0 1 0 0 1 0

1 0 1

0 0 0 1 0 0 0 001h : 59m to test end 0 1 0 0 0 1 0 0 1 0

0

end 0 1 0 0 0 1 0 0 1 0 1 0 0 1 0

- Programming

Pick one of the choices

-

 
  2

2

1
1
1 6

6

2
2
2 8

8

5

5

- Problem

Solving -

Solving - None of the above

None of the above

Clear selection 3 4 5 6 7 8 9 10 11 12
Clear selection
3
4
5
6
7
8
9
10
11
12

- Advanced -

13
13

GS Engineers Campus Hiring Program :: powered by HackerRank

GS Engineers Campus Hiring Program :: powered by HackerRank GS Engineers Campus Hiring Program

GS Engineers Campus Hiring Program

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

01h : 59m to test end - Programming - 1 2 - Problem Solving

01h : 59m to test end

01h : 59m to test end - Programming - 1 2 - Problem Solving - -
01h : 59m to test end - Programming - 1 2 - Problem Solving - -

- Programming

-

1 2
1
2

- Problem

Solving -

- Advanced -

13
13

- Tell us about