Interview Questions

Q:

What is the output of this program ?

class main_arguments {
            public static void main(String [ ] args)
            {
                String [][] argument = new String[2][2];
                int x;
                argument[0] = args;
                x = argument[0].length;
                for (int y = 0; y < x; y++)
                    System.out.print(" " + argument[0][y]);           
            }
        }

A) 1 1 B) 1 0
C) 1 0 3 D) 1 2 3
 
Answer & Explanation Answer: D) 1 2 3

Explanation:

In argument[0] = args;, the reference variable arg[0], which was referring to an array with two elements, is reassigned to an array (args) with three elements.
Output:
$ javac main_arguments.java
$ java main_arguments
1 2 3

Report Error

View Answer Report Error Discuss

Filed Under: Java
Exam Prep: GATE

0 18105
Q:

What is a spanning Tree?

Answer

A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized

Report Error

View answer Workspace Report Error Discuss

Subject: Technology

1 747
Q:

Classify the Hashing Functions based on the various methods by which the key value is found.

Answer

Direct method,


 Subtraction method,


 Modulo-Division method,


 Digit-Extraction method,


 Mid-Square method,


 Folding method,


Pseudo-random method

Report Error

View answer Workspace Report Error Discuss

Subject: Technology

4 3277
Q:

List out few of the applications that make use of Multilinked Structures?

Answer

Sparse matrix,


Index generation

Report Error

View answer Workspace Report Error Discuss

Subject: Technology

1 1666
Q:

What is the data structures used to perform recursion?

Answer

Stack. Because of its LIFO (Last In First Out) property it remembers its ‘caller’ so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

3 5851
Q:

List out the areas in which data structures are applied extensively?

Answer

Compiler Design,


 Operating System,


 Database Management System,


Statistical analysis package,


Numerical Analysis,


 Graphics,


 Artificial Intelligence,


 Simulation

Report Error

View answer Workspace Report Error Discuss

Subject: C++

4 4021
Q:

When Were You Most Satisfied in Your Job?

Answer

The interviewer wants to know what motivates you. If you can relate an example of a job or project when you were excited, the interviewer will get an idea of your preferences.


Eg: "I was very satisfied in my last job, because I worked directly with the customers and their problems; that is an important part of the job for me."

Report Error

View answer Workspace Report Error Discuss

Subject: About Yourself

14 4581
Q:

Why Did You Leave Your Last Job?

Answer

The Best way to answer this question:


Be honest but stay positive.  Of course, your answer should be based on the real reason you left, but put a positive spin on it. That means, you should try to frame your honest answer in the most positive way possible.Do not lie, be truthful and honest but do not be harsh on a previous employer. So answer truthfully while at the same time NOT talking about the company or staff in a negative light. More info on why you left a job would help to give applicable suggestions. You TELL them why you left! .  Make it sound as positive as possible though. Put the reason you are no longer at your last job in your question. Unless you were laid off or the company had relocated you too far, just say "it's a career move." It's better not to go into the specifics. Always keep in mind that your  interviewer is looking for a positive, motivated, hard-working candidate. No potential employer wants to hear your gripe about a prior boss or talk poorly about a previous employer. She or he wants to hear about your potential as a superstar at the position you are seeking.

Report Error

View answer Workspace Report Error Discuss

1 1686