Java - Interview Questions and Answers for 'Stream' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2098 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Stream' - 25 question(s) found - Order By Newest

 Q1. What is a stream and what are the types of Streams and classes of the Streams?Core Java
Admin
info@buggybread.com
Ans. A Stream is an abstraction that either produces or consumes information. There are two types of Streams :

Byte Streams: Provide a convenient means for handling input and output of bytes.

Character Streams: Provide a convenient means for handling input & output of characters.

Byte Streams classes: Are defined by using two abstract classes, namely InputStream and OutputStream.

Character Streams classes: Are defined by using two abstract classes, namely Reader and Writer.

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

   Like      Discuss      Correct / Improve     java   file io   streams   byte stream   character stream


Frequently asked to fresh graduates.
  Q2. What is a Deadlock ?Operating System
Anonymous
Ans. When two threads are waiting each other and cant precede the program is said to be deadlock.

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

   Like      Discuss      Correct / Improve     java   threads   multi threading   operating system   deadlock  concurrency     Lime Wire  Perfect Sense  QuantCast  Aequitas NEO Exchange  Akuna Capital  Juniper Networks  Casale Media  Netflix  NetApp  Apple  AIG  Cpart  SnapStream Media  Cumulus Systems  Wissen Infotech  HedgeServ Corp  KeyIdeas Infotech  Verint Systems  BlackBerry  EverQuote      basic        frequent


 Q3. Name few IO Stream classes and interfaces ?Core Java
Admin
info@buggybread.com
Ans. http://www.buggybread.com/2015/01/java-stream-io-classes-and-interfaces.html

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

   Like      Discuss      Correct / Improve     java   io   input output   stream


 Q4. Explain System.out.println ?Core Java2016-11-25 09:37:08

Ans. System is a class within java.lang package that contains several useful class fields and methods. It cannot be instantiated and hence can use only statically.even in this case this has been used statically i.e with class name itself and without creating an instance.

out is the static reference of Printstream declared as following in the System Class -

public final static PrintStream out = null;

println is the method of PrintStream class.

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

   Like      Discuss      Correct / Improve     System class  Streams  Input Output  println      basic        frequent


 Q5. Tell something about BufferedWriter ? What are flush() and close() used for ?
Admin
info@buggybread.com
Ans. A Buffer is a temporary storage area for data. The BufferedWriter class is an output stream.It is an abstract class that creates a buffered character-output stream.Flush() is used to clear all the data characters stored in the buffer and clear the buffer.Close() is used to closes the character output stream.

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

   Like      Discuss      Correct / Improve     java   java io   input output   file handling   file io   output stream   bufferedwriter   flush   close


 Q6. What is Scanner class used for ? when was it introduced in Java ?
Admin
info@buggybread.com
Ans. Scanner class introduced in Java 1.5 for reading Data Stream from the imput device. Previously we used to write code to read a input using DataInputStream. After reading the stream , we can convert into respective data type using in.next() as String ,in.nextInt() as integer, in.nextDouble() as Double etc

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

   Like      Discuss      Correct / Improve     java   java5   scanner   file io   file input   data input stream


 Q7. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
Admin
info@buggybread.com
Ans. The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented

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

   Like      Discuss      Correct / Improve     java   file io   streams   reader class   writer class   inputstream   outputstream   stream


 Q8. Which is the abstract parent class of FileWriter ?
Admin
info@buggybread.com
Ans. OutputStreamWriter

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   filewriter   outputstreamwriter


 Q9. Which class is used to read streams of raw bytes from a file?Core Java
Admin
info@buggybread.com
Ans. FileInputStream

  Sample Code for FileInputStream

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   fileinputstream



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. Which is the Parent class of FileInputStream ?Core Java
Admin
info@buggybread.com
Ans. InputStream

  Sample Code for InputStream

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   fileinputstream   inputstream


 Q11. Which exceptions should be handled with the following code ?

FileOutputStream fileOutputStream = new FileOutputStream(new File("newFile.txt"));
Admin
info@buggybread.com
Ans. FileNotFoundException

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   coding   code   scjp   ocjp   filenotfoundexception   fileoutputstream


 Q12. Will this code compile fine ?

ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(new File("newFile.txt")));
Core Java
Admin
info@buggybread.com
Ans. Yes.

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   coding   code   objectoutputstream   fileoutputstream   yesno


 Q13. What is System.in in Java ?Core Java2016-09-02 08:24:11

Ans. It is an InputSream which is usually connected to the keyboard input of console program.

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

   Like      Discuss      Correct / Improve     System.in  Input Stream  Input Output


 Q14. Have you ever tried compressing data using Java ?Core Java2016-11-15 11:10:29

Ans. Yes, we can use ZipInputStream class for compressing the FileInputstream object.

  Sample Code for ZipInputStream

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

   Like      Discuss      Correct / Improve     file handling  FileInputstream  ZipInputStream


 Q15. How Spliterator in Java 8 different than iterator ?Core Java2016-11-24 09:44:49

Ans. Though there are many differences the way internally they both iterates the collections and streams respectively, but the main difference in performance that is achieved by spliterator as it can iterate Streams in Parallel whereas iterator only iterates collections sequentially.

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

   Like      Discuss      Correct / Improve     java8  java 8  spliterator  java 8 streams  streams


 Q16. Which is better in terms of performance - Iterator or Spliterator ?Core Java2016-11-24 09:46:26

Ans. Spliterator has better performance potential than iterators but only if the potential is used. Spliterator can iterate streams in parallel as well as in sequence whereas iterator can only iterate in sequence.

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

   Like      Discuss      Correct / Improve     iterator  collections  streams  parallel streams  Spliterator


 Q17. Difference between System.out.printf and System.out.println ?Core Java2016-11-25 09:38:09

Ans. println prints an additional end of line whereas printf doesnt.

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

   Like      Discuss      Correct / Improve     System class  Streams  Input Output  println  printf


 Q18. What is Spring Security ?Spring2017-01-10 09:13:58

Ans. Spring Security is a powerful and highly customizable authentication and access control framework. It is the de facto standard for securing Spring-based applications.

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

   Like      Discuss      Correct / Improve          Fidelity Investments  Anonymous Content  Istream Solutions


 Q19. What is the difference between the Reader/Writer java.io hierarchy and the Stream class hierarchy?Core Java2017-01-12 14:17:13

Ans. The Reader/Writer hierarchy is character oriented, whereas the Stream class hierarchy is byte oriented.

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

   Like      Discuss      Correct / Improve     java io  streams      intermediate



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



Usually asked to entry level software developers.
  Q20. Write a program to swap two variables without using thirdCore Java2017-01-19 15:38:34

Ans. public static void main(String[] args) {
   int num1 = 1;   
   int num2 = 2;
   num1 = num1^num2;
   num2 = num1^num2;
   num1 = num1^num2;
   System.out.print("num1 = " + num1 +", num2 = "+num2);
}

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

   Like      Discuss      Correct / Improve     code  coding     Deloitte  Colgate Palmolive  Tech Mahindra  SAP  Broadcom  Tata Consultancy (TCS)  Wipro  Gemalto  Time op  Nse Tech  Client Network Services  Monte Carlo  BrainMobi Technologies  Nokia  Minted LLC  Societe Generale  MetricStream  Sapient Global  HighRadius  Mindtree  Robert Bosch  Cypress Semiconductor  Tesco  NTT Data  Tejora Technologies  Saggezza  Elegant Microweb  AMD  Advanced Micro Devices  Tricon Infotech  Odessa Technologies  Aditi  Max Secure Software India  NetSuite  Volante Technologies  Subex Limited  Plintron Global Technology Solutions      basic        frequent


 Q21. Write a class / program that takes few numbers from the input and then output the average ?Core Java2017-01-27 14:26:00

Ans. public class Class{
   public static void main(String[] args){
      List<Integer> collector = new ArrayList();

      Scanner scanner = new Scanner(System.in);
      int x = scanner.nextInt();
      while(x != 0){
         collector.add(x);
         x = scanner.nextInt();
      }
      System.out.println(collector.stream().collect(Collectors.averagingInt(p->((Integer)p))));
   }
}

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

   Like      Discuss      Correct / Improve     coding  code  collector  streams  Collectors.average     Raytheon


 Q22. What is a gobbler class ?Core Java2017-03-25 10:38:17

Ans. A gobbler class take care of reading from a stream and optionally write out to another stream. Allows for non blocking reads when invoking a process through Runtime.exec(). Moreover the user can specify a callback that is called whenever anything is read from the stream.

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

   Like      Discuss      Correct / Improve     gobbler  stream


 Q23. What is a shard in Kinesis stream ?AWS2017-06-14 07:40:42

Ans. A shard is a uniquely identified group of data records in a stream or we can say that Shard is a partition in Kinesis stream. A shard supports a fixed bandwidth i.e fixed number of messages per second. The total capacity of the stream is the sum of the capacities of its shards. If the data rate changes, we can allocate / deallocate more shards to accommodate that.

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

   Like      Discuss      Correct / Improve     Amazon AWS  AWS  Amazon Kinesis Stream  shard  shard in amazon kinesis


 Q24. What is the relationship between shard and partition key in kinesis stream ?AWS2017-06-14 07:42:01

Ans. A partition key is used to group data by shard within a stream. A partition key identifies which shard the message belong to.

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

   Like      Discuss      Correct / Improve     Amazon AWS  AWS  Amazon Kinesis Stream  shard  shard in amazon kinesis   partition key in amazon kinesis   shard and partition key


 Q25. What is the difference between stream and parallel stream ?Core Java2017-08-17 11:02:04

 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     stream vs parallel stream  stream  parallel stream




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

5 person from are looking for questions for 'Stream'. Connect with them to better prepare for your interview.
X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: