0% found this document useful (0 votes)
990 views

Raja Software Labs interview Coding Questions

Uploaded by

jiwovi1945
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
990 views

Raja Software Labs interview Coding Questions

Uploaded by

jiwovi1945
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Raja Software Labs interview Coding Questions

Android And Java Developer


1)adding three numbers - the input = 483, the output should be 13(4+8+3)
2)How to find the second highest number in an integer array, without sorting the array?
3)merging two arrays with given mention method

4)*Palindrome string
*merging two arrays
*print number from 100 to 500 and print "cool" if the number is in multiplication of 5 and print
"dude" if number is in multiplication of 11 and print "cool dude" if number is in multiplication
of both 5 and 11.
*print two digit possible numbers from 0 to 5, but the two digit number should be like
decreasing one's place and increasing tens place.
*print the number if remainder is 3 when divided by 7 and exit if user press 0.

Interview Questions
Round 1 :-
Given printed sheet with 5 questions and you are supposed to write executable code.
Questions were:

1) isPalindrome string
2) merging two arrays alternatively
3)print number from 100 to 500 and print "cool" if the number is in multiplication of 5 and
print "dude" if number is in multiplication of 11 and print "cool dude" if number is in
multiplication of both 5 and 11.
4)print sequence like 50 51 52 53 54 55 40 41..........10 11 12 13 14 15
5)print the number if the remainder is 3 when divided by 7 and exit if user press 0.

Round 2 :-
1) Print this sequence:
*
**
***
****
2) Is the given year is leap or not ?
3) Find second smallest number in a given array.
4) Print given string ("Raja Software Labs") in this way ("Labs Software Raja"); not allowed
to use tokenizer, split or any other built in functions.

Round 3 (Technical Discussion + Programming) :-

1) Current Project Discussion


2) Discussion on various tools I am currently using.
3) Discussion on GIT, git commands, process, etc.
4) Write your own implementation of parseInt() method.

5) First non repeating character in the given string in O(n) complexity.

Merge two arrays in alternate manner with other restrictions.


Prime no
Decimal system conversions
finding prime number
reverse the singly linked list
Palindrome, decimal to binary, finding sum of even no from given array…
First 100 Prime numbers
wap to print the sum of integer values eg. if input is ( 345) O/P is 3+4+5=12.

merge two list by taking alternatively values from another eg( [2,3,5,8] [1,4,9,7] output
should be [2,1,3,4,5,9,8,7]

program to print occurrence of string such that eg. if input is aabbbcc .O/P should be
a2b3c2.

Hourglass problem

First non-repeating character from a string

Print triangle pattern of stars


1st round ----- programming (They ask mostly String manipulation)
2nd round ----- reduce complexity of your program
3nd round ----- HR

First Written Test


1. Palindrome
2.Merge Two Arrays
3. Cool Dude Program
4.Print serial like 50 51 52 53 54 55 40 41 42 53 54 55

second round
1. Convert numerical string to int without using any Standard function
2. Merge Two arrays alternatively one is int array and second one is char array with multiple
test cases

Software Developer

Prime numbers between 2 numbers


Leap year

1.coding questions from arrays and strings.


2.I java+oops questions in the last minutes

Fibonacci, primenumber, string operations etc.. All questions will have variations.
A-2: Write a function that takes an input parameter as a String. The function should reverse
the statement but keep the words intact and print it. Words are separated by dots. (Avoid
using inbuilt functions)

If input is “i.like.this.program.very.much”
Output will be “much.very.program.this.like.i”

A-3: Write a function which takes an input parameter as an array of integers and prints the
sum of all prime numbers from the given array. If all integers present in the input array are
non-prime the program should print sum as 0.

Example:
Input1: [1, 14, 5, 7] Output: sum=12
Input2: [2, 10, 13, 9] Output: sum=15

A-4: Write a program to merge two lists by alternatively taking elements from each list. The
method will take 2 arrays as input and return the merged array as output.
Input: [1,2,3] and [a,b,c] Output: [1,a,2,b,3,c]
Input: [1,2,3,4,5] and [a,b,c] Output: [1,a,2,b,3,c,4,5]
Input: [1,2,3] and [a,b,c,d,e] Output: [1,a,2,b,3,c,d,e]

A-5: Variation of Fibonacci


The Fibonacci sequence is constructed by adding the last two numbers of the sequence so
far to get the next number in the sequence. The first and the second numbers of the
sequence are defined as 0 and 1. We get:
0, 1, 1, 2, 3, 5, 8, 13, 21…
Write a function which takes input as a number:
If the given number is a Fibonacci number, print the number
If the given number is NOT a Fibonacci number, print the sum of all even Fibonacci
numbers less than the given number.

int getFibOutput(int input) {


// TODO:
}

Example
(21 is a Fibonacci number)
Input: 21 Output: 21
(20 is NOT a Fibonacci number so, output is 10 (2+8))
Input: 20 Output: 10

Interview Questions
Round 1:

Online test 1,

20ques in 60min. It includes medium level reasoning, Coding output and Aptitude test.

Round 2:

Online test 2,

3-5 Coding Ques, like pen-paper round. (No code compilation).


Round 3: Technical 1:

Video call, 2-3 coding ques.

Questions asked:

a) Anagram

b) Prime no. till n.

c) Non duplicate int from the list.

Round 4: Technical 2:

Video call, 2-3 code ques.

Questions Asked:

a)Digits of int ae in ascending or descending or not specified. Ex: 1378 - acs order, 743 -
desc order, 3574 - no specific order

b)List of marks are there, Tell the rank of the entered new mark. Ex: Marks List: {39, 38, 38,
36, 34, 31, 28}, if added mark is: 38: Rank2, 37:Rank3, 36:Rank3

c)Its was like a puzzle, 2 watches are there 1 for hrs(24) and 1 for min(60), Calculate the
shortest unit distance between the 2 time from these watches. Ex: t1=03:56, t2:18:12
Distance=9+16=25. Soln: min(h2 - h1, 24 - h2 + h1)+min(m2-m1, 60-m2+m1), where h2 is
the greater hr, m2 is the greater min. Try it. The interviewer was surprised to see the
solution so quickly from my end :-).
Final Round 5, Technical 3:

● HR related Ques:

1. Nearest prime numbers which are at minimum distance, if there are two prime numbers
which are at equidistance from the given prime number then print both the prime numbers.

36. Find second smallest number in a given array.

37.Write your own implementation of parseInt() method.

38.Write a program for Maximum profit by buying and selling a share at most
k times
Apples and oranges puzzle

39.find repeating numbers in an array

40.why array starts with 0

41.find two consecutive no in array which have maximum sum

42.check whether given number is strong number or not

43.Fibonacci series using recursion

44.meeting room problem.


45.implement inbuilt python functions

46. backtracking and simple logic (clock angle).

47.Minimum Profit/Buy and sell stocks

48.Maximum Frequency Character and its frequency

49.convert binary to decimal using recursion

50.convert string into number without using inbuilt function

51.check whether string is cyclic or not

52.String is anagram or not with space complexity constant

53.Find equilibrium point(index) in given array. Equilibrium point is


the element from where sum of all elements left to it is equal to sum
of all elements right to it.

54.implement inbuilt python functions.

55.Find the max distance between indexes of duplicate values from an array.

56. Write a function that prints out a breakdown of an integer intInput: 43018,
Output: Print 40000 + 3000 + 10 + 8

57. Find rank of students besed on marks there was given marks of 10 students
58. Count of elements which are power of 2 in array.

59. given list of students marks in decreasing order(same marks has same rank
i.e 36 34 34 20 19 1 2 2 3 4).Given new student mark.
find rank of new student in given list.

60.there are two clocks one is working properly(c1) and other one is dis-function(c2).
we given c2 is x mins faster than c1 per hour. And after k mins in c1.
If we stop c2 clock what will be total angle between hour and min hand in c2.
ex x=30 & k=90
output :- 744

64. Given an array including alphabates & dash.move all Dash at the end
without changing order of alphabets. O(N)

65. Minimum coins required of 2 & 5 to get N sum value O(1)

66. Given an integer array, find a pair with the given sum in it.

67. Dutch national flag

68. count pairs in array map implementation

69. Merge two sorted array

70. Check whether the vowels in a string are in alphabetical order or not
1.print the sum of elements of lower triangular matrix
2.binary array was given we have to sort it with using another array or any sorting algorithm
3.convert string into number without using inbuilt function
4.print the closet prime number of a given number
5 convert binary to decimal using recursion

Nearest Prime no.


binary to decimal using recusion
replace . in string with few word
Word Wrap, Pattern Printing, Anagram, etc.
Leap Year, Find the mid 4 characters of a string,etc..
count duplicates, palindrome string, give pairs in array

Write a code for Fibonacci sequence


1)find the angle between hour hand and minute hand according to given time.
2)find nearest prime no of a given number.
3)check whether string is cyclic or not
4)String is anagram or not with space complexity constant

1) Print all the repeating characters in given string.


input- afshfybs
output- af
2) print table of a number(e.g. table of 3)
input- 3
output -
3*1 = 3
3*2 = 6
3*3 = 9
.............
.............
3*10 = 30

3) merge two given arrays and return the resultant array.


input-arr1 = [1,2,3,4] arr2 = [7,8,9]
output- [1,2,3,4,7,8,9]

4) given a range of numbers(low, high) print all numbers in that range(inclusive) and print
"raja" if number is divisible by 7, "software" if number is divisible by 11 and "not a valid
output" if number is divisible by 11 and 7 both.
input- (6, 12)
output- 6, raja, 8, 9, 10, software, 12

5) Generate first n fibonacci numbers.


input- 7
ouptut- 0,1,1,2,3,5,8,13

6) Find equilibrium point(index) in given array. Equilibrium point is the element from where
sum of all elements left to it is equal to sum of all elements right to it.

7) reverse a given string of words.


input- raja software labs pune
output- pune labs software raja
8) Check if given two strings are anagrams or not.
ex- Listen & Silent, triangle & integral

9) Draw the following pyramid pattern:


*
***
*****
*******

10) Draw the following pyramid pattern:


*
**
***
****

11) Balance the given string of parenthesis(only one kind of brackets given in string).
input- { } } { }
output - { } { } { }

12) Find maximum profit earned by buying and selling shares (we are allowed to buy and
sell only once).
input- {1, 5, 2, 3, 7, 6, 4, 5}
output- 6 (buy stock when price = 1 and sell it when price = 7)

13) You are given 100 balls in a container mixed, out of which 98 are blue and 2 are red,
making probability of blue ball to pick at random = 0.98. How many balls and of which color
do we need to add inside the container to make the total probability = 0.99.
Answer- Add 100 blue balls.
1 Hour and Minute hand angle
2.Buy and sell stocks
3. Maximum Frequency Character and its frequency
4 Minimum Profit

Basic array questions(2nd max) , backtracking and simple logic (clock angle).
1 reverse each word in a given string.
2. implement inbuilt python functions.
3. meeting room problem.

1:print maximum count of 1's chain in array of numbers containing 0 and 1

2:second maximum in array in one loopstage 4: started with HR questions


coding questions :asked about bit operators
1:find the no.is odd or even by using only bitwise operator
2:count the number of different bits present in two integer number using bitwise operators

3:count maximum profit in array having stocks prices at different hour

Balance the brackets

Interview Questions

Round 1.

1. Leap Year.

2. Print 1st repeated character in string.


Round 2:-

1. Angle between hour and minute hand

2. Sell/Buy Stock for maximum profit.

3. String Compression(aaabbbcc->a3b3c2).

Interview Questions
Given a string return true if the letters are repeated and return false even if there is a single
letter which is not repeated.
Input:Raja
Output:False.

Explanation:Here R and J are noncrepeating element


reverse string, remove duplicates, find loop in linked list, add a node in linked list.

Interview Questions
1st round:
a) Reverse a String
b) Convert a String to Integer without using inbuilt APIs
c) Get quotient and remainder of two number without using %, /
d) Convert hexademinal number to byte
e) Print the Nunber of frequencies vowels occur in a String.

2nd round:
a) Find the max distance between indexes of duplicate values from an array.
For eg. [0,0,1,1,0,0] -> Funtion should return 4 as max distance is between second and
sixth zero(5-1=4)
b) Find the angle between hour and minue hand when time is 3:30
c) If given String is I_LOVE_INDIA reverse whole string except "_". Output for this would be
A_IDNI_EVOLI

3rd round:
a) Given array contain 1 and 0, put all 1 on left side and 0 on right side of the array
b) Check if two given Strings are anagram of each other.
For this I gave answer to use two hashmaps and compare both, he asked another
approach. So I told him i can use two array with length 256 and store charachter values
against ASCII index and than compare both arrays. He asked for another So I told him we
can sort the array and compare both arrays.
Than he asked if there is an inbuilt function which we can use, I was not able to answer.

● c) Given a number 1 to 100. Print "Raja" if number is divisible by 3 or Print


"Software" if number is divisible by 7 Print "Raja Software" if number is divisible by 3
and 7


1. Detect 101 pattern from 110101001010100

2. Convert number to string

3. Check Number is palindrome or not

4. Remove vowels from string


5. write program for ip address

You might also like