Interview Questions and Answers for 'T' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Rating

   next 30
 Q871. What is an exception ? What are the different types of exceptions ?Core Java
Ans. An exception is an unwanted or unexpected event, which occurs during the execution of a program that is at run time, that disrupts the normal flow of the program?s instructions. these are different types arithmetic exceptions, class not found exception, interrupted exception, run time exception etc.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q872. Write a custom exception.Core Java
Ans. if you are creating your own exception is known as custom exception.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q873. Write a program to find length of String without using library function.Core Java
Ans. Class lengofstring {
Public static void main(String[] arr) {
int i = 0;
String s = "hello world!";
for (char C: s.toCharArray()) i;
System.out.println("Length: "
i);
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q874. Write a program to find the 10th prime number.Core Java
Ans. import java.util.Scanner;
public class Prime
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter n to compute the nth prime number: ");
int nth = sc.nextInt();
int num, count, i;
num=1;
count=0;

while (count < nth){
num=num 1;
for (i = 2; i <= num; i )
{
if (num % i == 0)
{
break;
}
}
if ( i == num)
{
count = count 1;
}
}
System.out.println("Value of nth prime: " num);
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q875. Given an array with number 1 to n, find the missing numbers. Core Java
Ans. int main ()
{
int a []={1..n};
int miss=getMiss (a,n);
Printf ("%d",miss);
}
getMiss (int a [],int n){
int I,total;
total=(n 1)*(n 2);
for (i = 0; i < n; i++)
total -= a[i];
return total;
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q876. Write a program to rotate array elements clockwise.Core Java
Ans. class Rotate{

void leftRotate(int arr[], int d, int n)
{
for (int i = 0; i < d; i )
leftRotatebyOne(arr, n);
}

void leftRotatebyOne(int arr[], int n)
{
int i, temp;
temp = arr[0];
for (i = 0; i < n - 1; i )
arr[i] = arr[i 1];
arr[i] = temp;
}


void printArray(int arr[], int n)
{
for (int i = 0; i < n; i )
System.out.print(arr[i] " ");
}


public static void main(String[] args)
{
Rotate rotate = new Rotate();
int arr[] = { 1, 2, 3, 4, 5, 6, 7 };
rotate.leftRotate(arr, 2, 7);
rotate.printArray(arr, 7);
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q877. How do you fetch the records form database ?Database
Ans. To fetch records from a database, you would use SELECT statements

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q878. Does immutability facilitates better performance ?Core Java
Ans. Yes , but only the read performance in case we don't need to modify it much. In case we need to modify it a lot , it creates write performance overheads as we would need to create many news objects instead of just changing one.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     immutable  immutability objects  immutability


 Q879. What are the drawbacks of creating immutable objects ? Why don't we create all object immutable if mutability possesses so much threat ? Core Java
Ans. Immutable objects relieves us from the problems of inconsistencies and security and helps with better read performance but at the same time are write performance and storage overheads. In case any modification is required , a new object is created and thus creating multiple copies of it.

This is the reason we use StringBuffer / StringBuilder when we have to append some text multiple times and then create a String out of it.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     immutable  immutability objects  immutability


 Q880. How would you implement low latency data structures ?Data Structure
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q881. Find all paths of length L in an acyclic graphAlgorithm
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q882. Write code for serialization.Core Java
Ans. // Java code for serialization and deserialization
// of a Java object
import java.io.*;

class Demo implements java.io.Serializable
{
   public int a;
   public String b;

   // Default constructor
   public Demo(int a, String b)
   {
      this.a = a;
      this.b = b;
   }

}

class Test
{
   public static void main(String[] args)
   {
      Demo object = new Demo(1, "geeksforgeeks");
      String filename = "file.ser";
      
      // Serialization
      try
      {
         //Saving of object in a file
         FileOutputStream file = new FileOutputStream(filename);
         ObjectOutputStream out = new ObjectOutputStream(file);
         
         // Method for serialization of object
         out.writeObject(object);
         
         out.close();
         file.close();
         
         System.out.println("Object has been serialized");

      }
      
      catch(IOException ex)
      {
         System.out.println("IOException is caught");
      }


      Demo object1 = null;

      // Deserialization
      try
      {
         // Reading the object from a file
         FileInputStream file = new FileInputStream(filename);
         ObjectInputStream in = new ObjectInputStream(file);
         
         // Method for deserialization of object
         object1 = (Demo)in.readObject();
         
         in.close();
         file.close();
         
         System.out.println("Object has been deserialized ");
         System.out.println("a = " object1.a);
         System.out.println("b = " object1.b);
      }
      
      catch(IOException ex)
      {
         System.out.println("IOException is caught");
      }
      
      catch(ClassNotFoundException ex)
      {
         System.out.println("ClassNotFoundException is caught");
      }

   }
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     serialization     Asked in 1 Companies


 Q883. What is Web Server and explain its types?Server
Ans. A program that uses HTTP for serving files that create web pages for users in response to their requests that are sent by the HTTP clients of their computer is called as a web server.

Web - Server Types

Apache HTTP Server by the Apache Software Foundation
Internet Information Service from Microsoft
Sun Java System Web Server
Jigsaw Server.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     production support     Asked in 1 Companies


 Q884. What Parameter we need to specify while creating sockets ?
 This question was recently asked at 'Symantec'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q885. Can the double checked locking fail on single processor system ?
Ans. There is no mapping of single ton with number of processor of the system. So double check locking will not fail depending on number of processor.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q886. Write a Program to find number of lines , words and characters in a File.Core Java
Ans. import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class FileUtility {

public static void main(String[] args) {
System.out.println(printFile("/home/userme/notes"));
}

private static int printFile(String filePath) {
int wordCount = 0;
try (BufferedReader br = new BufferedReader(new FileReader(filePath))) {
String line = null;
String[] wordsArray = null;

while ((line = br.readLine()) != null) {
wordsArray = line.split(" ");
wordCount = wordsArray.length;
}
} catch (IOException e) {
e.printStackTrace();
}
return wordCount;

}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     code  coding     Asked in 2 Companies


 Q887. Describe SQL JoinsDatabase
Ans. Oracle having following types of joins these are also called 8i joins. There are:

1. Equi (or) Inner join
2. Non Equi join
3.Self join
4.Outer join

Oracle also support the 9i (or) ANSI standard joins.There are:

1.Inner join
2.Left outer join
3.Right outer join
4.Full outer join
5.Natural join

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sql joins  sql     Asked in 2 Companies


 Q888. Why String is a class in Java ?Core Java
 This question was recently asked at 'NIIT Technologies'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q889. What is the use of @import annotation ?
Ans. @Import annotation in Spring allows you to load bean definitions from one or more another @Configuration files or Components. You might not want to configure all the beans in one configuration file.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q890. How to capture Screenshot when the testcases are failed?Testing
Ans. Using Listeners

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     testng  selenium     Asked in 1 Companies


 Q891. What is the use of second level cache in Hibernate ?Hibernate
Ans. Second level cache is shared between sessions. Hibernate by default uses first level cache. Second level cache need to be configurd to use.
There are several second level cache e.g eh cache,jboss cache etc.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q892. Why do we need to specify import statement ? Don't you think Java could have been designed in such a way to automatically import everything that's in the class path ?Core Java
Ans. Java could design it in such a manner but would result in ambiguity if there are multiple files with the same name. The only way to get over it to show the message when you use any such class to provide explicit import with the package prefix. The other problem could be that Java might have to change the early import to Late import and check what's being used to decide what needs to be imported as otherwise you will see errors regarding the ambiguous imports with duplicate file name.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     import      expert


 Q893. Explain Binary SearchAlgorithm
 This question was recently asked at 'Nagarvision'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     search  binary search     Asked in 1 Companies      basic        frequent


 Q894. How can we make objects if the constructor is private ? Core Java
 This question was recently asked at 'Nagravision'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     constructor     Asked in 1 Companies


 Q895. How is RDBMS different from DBMS ?Database
 This question was recently asked at 'LumenData'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     database  rdbms  dbms  dbms vs rdbms     Asked in 1 Companies      basic


 Q896. What is a CNAME alias ?Networking
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q897. What are the characteristics of the object ? Core Java
Ans. 1. State

Instance variable or member elements forms the object state.

2. Behavior

Member functions forms the object behavior

3. Identity

Every object has a unique identity within JVM through a unique Id.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  oops concepts


 Q898. Can we modify a list while iterating it ?Core Java
Ans. No,we cannot.I t will give concurrentModificationExceptin error. It can be resolved by using ConcurrentClasses like ConcurrentHashMap,CopyOnWriteArrayList,BlockingQueue etc which are fail-safe and wont give exception.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     collections  list  iterator     Asked in 1 Companies      basic


 Q899. Can we reserve resources in AWS Lambda just like we do for Ec2 instances ?Amazon Web Services (AWS)
Ans. You can have reserved capacity with AWS Lambda. This guarantees that this number of concurrent Lambdas are always available for that function.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     aws  aws lambda  aws serverless computing  amazon cloud serverless computing  amazon lambda  aws ec2  aws computing  amazon cloud computing  amazon ec2


 Q900. Can we build web services using AWS Lambda ?Amazon Web Services (AWS)
Ans. We have to complement it to AWS Gateway API.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     AWS Lambda  AWS Serverless  AWS Gateway


previous 30   next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: