2 trains of which one is 100m long and the other 150m are traveling towards each other at 45Km/hr and 55Km/hr respectively on 2 parallel tracks. How long will the 2 trains take to completely cross each other after they meet.
A) 12s
B) 18s
c) 9s
D) 15s
A box contains 5 brown and 4 white socks. A man takes out two socks. The probability that they are of the same colour
A) 1/6
B) 5/18
C) 4/9
D) 5/108
If the variance of the data 2, 4, 5, 6, 17 is v, then What is the variance of the data 4, 8, 10, 12, 34?
A) 2v
B) v
C) 4v
D) 3v
A survey of faculty and graduate students at the Mumbai Film Academy revealed the following information: 51 admire Aamir Khan, 49 admire Shahrukh Khan, 60 admire Salman Khan, 34 admire Aamir Khan and Shahrukh Khan, 32 admire Shahrukh Khan and Salman Khan, 36 admire Aamir Khan and Salman Khan, 24 admire all three of the Khans and 3 admire none of the three Khans. How many admire not more than one of the Khans?
A) 31
B) 28
C) 39
D) 84
A fair coin is tossed repeatedly. The probability of getting a result in the fifth toss different from those obtained in the first four tosses is
A) 1/32
B) 1/2
C) 1/16
D) 31/32
The principal, which will amount to Rs. 270.40 in 2 years at the rate of 4% per annum compound interest, is (in Rs.)
A) 225
B) 200
C) 220
D) 250
BFH, EJL, HNP, ?
A) LSU
B) JQS
C) KRS
D) KRT
Find the LCM of 45, 90, 135.
A) 2 X 3^3 X 5
B) 2^2 x 3^3 x 5
C) None of these
D) 2 x 3^3 x 5^2
If x is directly proportional to y and x is increased by 30% then what would be the ratio of initial and final values of y?
A) 10:13
B) 10:11
C) none of these
D) 5:7
A software engineer has the capability of thinking 100 lines of code in five minutes and can type 100 lines of code in 10 minutes. He takes a break for five minutes after every ten minutes. How many lines of codes will he complete typing after an hour?
A) 500
B) 300
C) 150
D) 200
At what time between 2 and 3 o'clock will the hands of a clock form an angle of 90 from each other?
A) 2:27:16.36
B) 2:27:81.81
C) none of these
D) 2:27
What will be the time complexity of inserting a node at the end of a circular Doubly linked list assuming that a pointer to the first node is given? A) O(N)
B) O(1)
C) none of these
D) O(log(N))
The average age of 4 children is 11.25 years. Their age ratio is 2:3:4:6.What is the age of the eldest child?
A) 12
B) 16
C) 18
D) 17
What is the fastest time complexity to multiply two numbers of 'n' length each using the Karatsuba algorithm?
A) O(LOG(N))
B) O(N)
C) O(N^1.6)
D) O(N^2)
Four Ninjas are standing in a queue with initial configuration as Ninja1, Ninja2, Ninja3, Ninja4. ‘Ninja1’ is at the front. How can we get the configuration as Ninja4, Ninja3, Ninja2, Ninja1?
A) 3 deletions, 2 additions
B) 2 deletions, 3 additions
C) 3 deletions, 3 additions
D) 3 deletions, 4 additions
What will be the time complexity of multiplying two numbers 'n' and 'm', in a computer system that uses hexadecimal instead of the binary system. Using the School Multiplication algorithm?
A) O(N * M)
B) O(log16(N) * LOG16(M))
C) O(log2(n) * log2(m))
D) O(N+M)
The length and breadth of a rectangle are changed by +10% and -10%. What is the percentage change in area of rectangle?
A) -2%
B) -1%
C) +2%
D) +1%
In how many ways can the letters of the word HIPPOPOTAMUS be arranged?
A) 12!/12!
B) 12!
C) 12!/(2! X 3!)
D) 12!/3!
A shopkeeper arranged eight mobiles of different brand each : Gionee, Lenovo, Samsung, Casio, Wiko, Huawei, Poco and Toshiba. Casio is third to the left of Wiko and next to the right of Lenovo. Poco is second from the right end and exactly between Huawei and Gionee. Samsung is second to the left of Huawei. Which of the following is the correct position of Huawei’s mobile?
A) THIRD TO THE RIGHT OF TOSHIBA
B) SIXTH TO THE RIGHT OF LENOVO
C) SECOND TO THE RIGHT OF GIONEE
D) BETWEEN GIONEE AND WIKO
If mean and median of some observations is 50 and 100 respectively. Find the mode of the same observations.
A) 300
B) 200
C) 100
D) 150
An AVL tree is formed using inserting the following elements in the given order. 1, 2, 3, 4, 5, 6, 7 What is the array representation of the given tree?
A) 1 2 3 4 5 6 7
B) 3 2 4 1 5 6 7
C) 4 2 6 1 3 5 7
D) 4 2 5 1 6 3 7
A, B, C, D, E and F are six members of a family. C is not the mother of B but B is son of C. A and C are married couple. E is the brother of C. F is the brother of B. D is the daughter of A. Which of the following is a pair of females?
A) BD
B) AD
C) BA
D) CA
If G = (V, E) is a connected graph and |V| = N and |E| = M, then the spanning tree of G must have?
A) M-1 edges
B) N vertices
C) None of the above
D) Both 1 and 2
What will be the output after the first pass of the QuickSort algorithm on 13, 34, 22, 19, 8, 3, 4? (Assume pivot is the first element of the array.)
A) 34 22 13 19 8 3 4
B) 4 8 3 13 22 19
C) 22 19 34 8 4 3
D) 3 4 8 13 34 22 19
Five villages P, Q, R, S, T are adjacent to each other. P is west of Q, S is East of T. R is South of P. T is North of Q. Which direction is R from S?
A) South-East
B) North-East
C) cannot be determined
D) South_West
Which of the following sorting algorithm uses a binary tree data structure?
A) Insertion Sort
B) Heap Sort
C) Quick Sort
D) Bubble Sort
In what ratio must a grocer mix two varieties of tea worth Rs. 20 a kg and Rs. 50 a kg so that by selling the mixture at Rs. 48 a kg he may gain 20%?
A) 2:3
B) 1:2
C) 2:1
D) 3:4
The difference between the squares of two consecutive odd integers is always divisible by?
A) 6
B) 0
C) 9
D) 8
The x-y chart I shows the distance covered by Amit in five different races –A, B, C, D & E.
The x-y chart II shows the time taken to cover these five races – A, B, C , D & E
Based on the above charts answer the following questions. In which race speed of Amit is minimum?
A) B
B) A
C) D
D) C
What is the area of the given figure?
A) 30cm^2
B) 60cm^2
C) 20cm^2
D) 40cm^2
Problem Statement
Ninja has been given two strings ‘A’ and ‘B’ both of the same length, ‘N’, Now Ninja has been assigned a task to make another string 'C' consisting of the characters of the string 'A' and string 'B' alternatively from the first position of the string 'A'. Ninja needs your help to create string 'C', the alternate merged string of the strings 'A' and string 'B'.
Example:
Input: 'N' = 3, 'A' ="abc", 'B' = "pqr"
Output: "apbqcr"
It is self-explanatory that the alternate merged string of the strings "abc" and "pqr" will be "apbqcr"
Input Format:
The first line of input contains an integer 'T', denoting the number of test cases.
For each test case, the first line will contain integer 'N', the size of the input strings 'A' and 'B'. The second line will contain the string 'A' and the third line will contain the string 'B'.
Output Format:
For each test case, print only one line containing the merged string of the input strings 'A' and 'B'.
Note:
You don't need to print anything. It has already been taken care of. Just implement the given function.
Constraints:
1 <= 'T' <= 5
1 <= 'N' <= 10^5
Time Limit: 1 sec
Sample Input 1:
2
3
abc
bbc
4
xyxy
xyae
Sample Output 1:
abbbcc
xxyyxaye
Explanation Of Sample Input 1 :
For the first test case, It is self-explanatory that the alternate merged string of the strings "abc" and "bbc" will be "abbbcc"
For the first second case, It is self-explanatory that the alternate merged string of the strings "xyxy" and "xyae" will be "xxyyxaye"
Sample Input 2 :
2
5
abcde
efghi
1
a
a
Sample Output 2 :
aebfcgdhei
aa
Solution:
#solution please
Problem Statement
Ninja is given an array ‘A’ of size ‘N’ where each element defines the difficulty of the problem. He needs to find the number of ways he can choose the contiguous segments such that the sum of difficulty of each segment is at least ‘K’.
For example:
Let’s say N = 4, K = 10 and A[] = {‘6’ , ‘1’ , ‘2’ , ‘7’}.
The contiguous segments {‘6’, ‘1’, ‘2’, ‘7’} and {‘1’, ‘2’, ‘7’} are the only segments having a sum greater than or equal to 10.
Input Format:
First-line contains ‘T’, denoting the number of Test cases.
For each Test case:
The first line contains a single integer ‘N’ denoting the size of the array.
The second line contains a single integer ‘K’.
The third line contains 'N' space-separated integers denoting the elements of the array ‘A’.
Output Format:
For each test case, you have to print the number of contiguous segments having a sum of at least ‘K’.
Note:
You don’t need to print anything. It has already been taken care of. Just implement the given function.
Constraints:
1 <= ‘T’ <= 5
4 <= ‘N’ <= 10^5
0 <= ‘A[i]’ <= 10^5
1 <= ‘K’ <= 10^5
Time Limit: 1 sec
Sample Input 1:
2
4
10
6 1 2 7
4
15
6 1 2 7
Sample output 1:
3
4
Explanation For Sample Input 1:
For test case 1:
The contiguous segments {‘6’, ‘1’, ‘2’, ‘7’} and {‘1’, ‘2’, ‘7’} are the only segments having a sum greater than or equal to 10.
For test case 2:
The contiguous segment {‘6’, ‘1’, ‘2’, ‘7’} is the only segment having a sum greater than or equal to 10.
Sample Input 2
2
3
5
3 3 3
5
7
1 2 3 4 5
Sample Output 2
3
7
Solution:
#solution please
Problem Statement
Ninja has been given a digit array ‘A’ of size ‘N’. A digit array contains only digit integers from 0 to 9.
A subarray is strong if the sum of all elements in it is equal to the length of the subarray.
Now, ninja wonders how many strong subarrays are there in an array; your task is to help the ninja to find the number of strong subarrays in an array.
EXAMPLE:
Input: 'N' = 3, 'A' = [1, 2, 0]
Output: 3
In the given array, subarrays [1], [1, 2, 0] and [2, 0] are strong subarrays.
Input Format:
The first line will contain integer 'T', denoting the number of test cases.
For each test case, the first line will contain an integer 'N',
the number of digits in an array 'A', and the next line will contain the array elements.
Output Format:
For each test case, print the number of strong subarrays in the given input array.
Note:
You don't need to print anything. It has already been taken care of. Just implement the given function.
Constraints:
1 <= 'T' <= 10
1 <= 'N'<= 10^4
0 <= 'A[i]' <= 9
Time Limit: 1 sec
Sample Input 1:
2
4
1 0 0 1
5
1 2 3 4 3
Sample Output 1:
2
1
Explanation Of Sample Input 1:
For the first test case, there are two strong subarrays [1] from the
first position and [1] from the last position.
For the second case, there is only one strong subarray [1] from the first position.
Sample Input 2:
2
5
1 1 0 1 1
6
6 0 0 0 0 5
Sample Output 2:
6
1