Nagarro Interview Questions – Set 1

Company: Nagarro Coding Round: It consists 4 questions. Q1. Input an array and then print the repeating characters?? Example: Input:1,3,23,11,44,3,23,2,3. Output:3,23 Q2. Input an array and prints the second minimum in an array?? Example Input:34,45,21,12,54,67,15 Output:15 Q3. Find the longest palendrom in a string? Example Input: abfgerccdedccfgfer Output: ccdedcc Q4. Input a number and then Read More →

Print Linked List Elements in Reverse order

Write a program to print elements of a linked list in reverse order by using same single linked list. Solution: We can solve this problem without actually reversing the linked list. Using recursion we have given the below solution. This implementation will be internally using stack to store each recursive function call. Complexity: O(N), where Read More →

Can we Overload Static methods in Java ?

Overloading: Overloading is also a feature of OOPs languages like Java that is related to compile time (or static) polymorphism. This feature allows different methods to have same name, but different signatures, especially number of input parameters and type of input parameters. Can we overload static methods? The answer is ‘Yes’. We can have two Read More →

Why can’t constructors be final, static or abstract in Java?

When you set a method as final, it means : “You don’t want any class override it”, but constructor by JLS definition can’t overridden,so it is clean. When you set a method as ‘abstract’,it means:”Method don’t have any body and you want to implement it at another time in a child class”, but the constructor Read More →

Can there be more than one main method in a Java Program

Yes, you can have as many main methods as you like. You can have main methods with different signatures from main(String[]) which is called overloading, and the JVM will ignore those main methods. You can have one public static void main(String[] args) method in each class. Some people use those methods for testing. They can test the operation Read More →

Amazon Interview Questions – Set 8 (On campus)

Campus: MNIT jaipur 2014 batch CTC Offered:  21LPA Online Round (90 minutes):20 Basic MCQs (Data structure, C, C++, OS, Aptitude, Networks).2 programs. Technical Interview: Q1. Check given binary tree is BST or not? Q2. Find 2nd maximum element in a given array in one iteration. Q3. Given a distance n. A person standing at position 0 has to Read More →

Programming Interview Riddle

interview riddle

Puzzle: You are playing a game with your friend Jack. There are digits from 1 to 9. You both will take turn erasing one digit and adding it to your score. The first one to score 15 points will win the game. Would you want to play first or second? PS: The sum should be Read More →

Can We Declare a Class Private in Java

Outer or concrete class can’t be private in java. For example: Output: Compile Time Error It is because, java follows oops concepts. If you make any class as private, it will not be accessible from another class. So there can’t be inheritance, runtime polymorphism, abstraction etc. But, nested class can be private. For instance: Output: Read More →

Check if Any Anagram of a String is Palindrome or Not

Examples: Input: str = “aaaad” Output: 1 // “aaaad” is a anagram of a palindrome “aadaa” Input: str = “abcd” Output: 0 // “abcd” is not a anagram of any palindrome. A Simple Solution is to take the input string, try every possible rotation of it and return true if a anagram is a palindrome. Read More →

Campus Placement Paper – Set 2

In our campus placement series, this is set-2 of programming questions. Below are little more advanced and frequently asked questions. Purpose of this set is to getting you ready for any kind of question that may be asked. Programming Questions :- Q1. How do you find the middle of a linked list? Write a C Read More →

Citi Bank Interview Questions – Set 1

Company : Citi Bank College: DCE The first round was a Online written round. A third party platform, amcat, conducted it. There were different sections from Basic Programming knowledge MCQ, Quantitative Aptitude, Logical Reasoning and a couple of coding questions. The test was adaptive, although there wasn’t any negative marking, but you could not go Read More →

Directi Interview Questions (Internship)

Company: DirectI (Internship) Stipend : 50k / month Round 1: Online coding round (90 mins) To proceed to interviews, either 1 of the 2 questions needed to be completely solved. Q 1: Brute Force with minor optimization. Q 2: Constructing a tree and finding its diameter. Round 2: It was a telephonic round which lasted about 45 Read More →