You are on page 1of 3

what is abstraction ?

what is data hiding ?


what is polymorphism ?
what is inheritance?
what is try catch throw ?
what is linked list ?? advantages over array.
what is heap?? min heap and max heap ?
what is binary tree application of BST??
what is structure??
what is union ??
what is enum ??
What is Binary Search Tree?
Write an algorithm for BST?
Write an algorithm for Bubble Sort?
Q) what is garbage collector
Q) how to retrieve a database result through C program
Q) one sql query on joins
Q) few basic c questions, very basic
Q) some questions on my project
Q) what is data structure
Q) difference between DS & Array
Q) what is priority queue
Q) implementation of priority queue [verbally, not the code]
Difference b/w local and static variable in C++.
Life and scope of local and static variable.
Reverse a linked list without using extra pointer and space(I gave recursive implementation using 1
extra pointer
How many square in (8*8) chess board.

2. Then he asked some puzzles..!


-You are given a 100 integers and these integers are in the range of 1 to 100. There are no
duplicates in list.Find one missing integer. What if 2 no is missing?
-Count ways to reach the nth stair taking 1 or 2 steps at a time.
-How many runs(maximum) a single player can score in One day match (50 overs/ 300 balls) No

no balls, no wides, no extras, no over throws.


-Three co-workers want to know their average salary,without disclosing their own salaries to other
two?
5. Some basic questions on data structure
-Binary search
-Merge sort(only approach)
-Given an array of integers which is initially increasing and then decreasing, find the maximum value
in the array.(Expected complexity O(logn))
eg1:Input: arr[] = {1, 3, 50, 10, 9, 7, 6}
Output: 50
eg2:Input: arr[] = {10, 20, 30, 40, 50}
Output: 50
-What is stack.Real life example
-C Program to check if a singly linked list is palindrome
-C Program for Detect and Remove Loop in a Linked List
-What is BST? insert element in BST(only approach)
-Convert a Binary Tree into its Mirror Tree

3) Write a Function to check if the given string contains the given number of unique characters (You
should ignore case of character so R & r should be counted as same character.).
Input :- String : NagarroisBestSoftwareCompany.
N(given no. of unique characters) = 17
Output :- True or False

1) Given a string, find the longest sub-string with all distinct characters in it.If there are multiple such
strings, print them all. -O(n) solution was expected.
2) Find all common elements in given 3 sorted arrays.-O(n) time & no extra space.
3) Print given matrix in a spiral form-Tested for all corner cases.
4) Few basics like ACID properties, what is normalization, why do we do it? etc.
5) Asked to write a program to print the following pattern, if n=5:

55555

54444
54333
54322
54321

and generalize it for all n.


1. Check if binary conversion of given number is palindrome or not. Ex: 6 (0110) is palindrome.
I used a recursive function for binary conversion and then check for palindrome using a loop. Refrain from
using inbuilt functions as they wanna check your logic. O(n) time complexity.
2. Separate 0s and 1s in that order from a array of only 0s and 1s.
I used partition algorithm (Quick Sort) to do the same. O(n) time complexity.
3. One Sentence (string) is given. find out the words, that has length even and greater than equal to 4
(e.g.4,6,8.. etc.) and separate them with space.
e.g. Given String : abcd abc abcde abcdef
Output: ab cd abc abcde abc def
I allocated a new string dynamically, and used two for loops to copy one string to another, adding a space
at the middle of the word where word length was >=4 and even. O(n^2) time complexity.
It seems easy but it isnt. I got to know that this can be minimized to O(n) time complexity in the next
round.

You might also like