LARA TECHNOLOGIES EXAM_SPECIALSIX SECTION-1

Size: px
Start display at page:

Download "LARA TECHNOLOGIES EXAM_SPECIALSIX SECTION-1"

Transcription

1 Q: 01. SECTION-1 Q: 02 Given: 12. import java.io.*; 13. public class Forest implements Serializable { 14. private Tree tree = new Tree(); 15. public static void main(string [] args) { 16. Forest f = new Forest(); 17. try { 18. FileOutputStream fs = new FileOutputStream("Forest.ser"); 19. ObjectOutputStream os = new ObjectOutputStream(fs); 20. os.writeobject(f); os.close(); 21. catch (Exception ex) { ex.printstacktrace();

2 24. class Tree { What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. An instance of Forest is serialized. D. An instance of Forest and an instance of Tree are both serialized. Q: 03 Q: 04 Assuming that the serializebanana() and the deserializebanana() methods will correctly use Java serialization and given: 13. import java.io.*; 14. class Food implements Serializable {int good = 3; 2

3 15. class Fruit extends Food {int juice = 5; 16. public class Banana extends Fruit { 17. int yellow = 4; 18. public static void main(string [] args) { 19. Banana b = new Banana(); Banana b2 = new Banana(); 20. b.serializebanana(b); // assume correct serialization 21. b2 = b.deserializebanana(); // assume correct 22. System.out.println("restore "+b2.yellow+ b2.juice+b2.good); // more Banana methods go here 50. What is the result? A. restore 400 B. restore 403 C. restore 453 D. Compilation fails. E. An exception is thrown at runtime. Q: 05 Which three statements concerning the use of the java.io.serializable interface are true? (Choose three.) A. Objects from classes that use aggregation cannot be serialized. B. An object serialized on one JVM can be successfully deserialized on a different JVM. C. The values in fields with the volatile modifier will NOT survive serialization and deserialization. D. The values in fields with the transient modifier will NOT survive serialization and deserialization. E. It is legal to serialize an object of a type that has a supertype that does NOT implement java.io.serializable. Q: 06 Assuming that the serializebanana2() and the deserializebanana2() methods will correctly use Java serialization and given: 13. import java.io.*; 14. class Food {Food() { System.out.print("1"); 3

4 15. class Fruit extends Food implements Serializable { 16. Fruit() { System.out.print("2"); 17. public class Banana2 extends Fruit { int size = 42; 18. public static void main(string [] args) { 19. Banana2 b = new Banana2(); 20. b.serializebanana2(b); // assume correct serialization 21. b = b.deserializebanana2(b); // assume correct 22. System.out.println(" restored " + b.size + " "); 23. // more Banana2 methods 24. What is the result? A. Compilation fails. B. 1 restored 42 C. 12 restored 42 D. 121 restored 42 E restored 42 F. An exception is thrown at runtime. Q: 7 When comparing java.io.bufferedwriter to java.io.filewriter, which capability exists as a method in only one of the two? A. closing the stream B. flushing the stream C. writing to the stream D. marking a location in the stream E. writing a line separator to the stream 4

5 Question: 8 Given: 10. class MakeFile { 11. public static void main(string[] args) { 12. try { 13. File directory = new File( d ); 14. File file = new File(directory, f ); 15. if(!file.exists()) { 16. file.createnewfile(); catch (IOException e) { 19. e.printstacktrace The current directory does NOT contain a directory named d. Which three are true? (Choose three.) A. Line 16 is never executed. B. An exception is thrown at runtime. C. Line 13 creates a File object named d. D. Line 14 creates a File object named f. E. Line 13 creates a directory named d in the file system. F. Line 16 creates a directory named d and a file f within it in the file system. G. Line 14 creates a file named f inside of the directory named d in the file system. 5

6 Q: 09. Q:10. Which code, inserted at line 14, will allow this class to correctly serialize and deserialize? 6

7 A. s.defaultreadobject(); B. this = s.defaultreadobject(); C. y = s.readint(); x = s.readint(); D. x = s.readint(); y = s.readint(); Question: 11 Given: 10. public class Foo implements java.io.serializable { 11. private int x; 12. public int getx() { return x; 12.publicFoo(int x){this.x=x; 13. private void writeobject( ObjectOutputStream s) 7

8 14. throws IOException { 15. // insert code here Which code fragment, inserted at line 15, will allow Foo objects to be correctly serialized and deserialized? A. s.writeint(x); B. s.serialize(x); C. s.writeobject(x); D. s.defaultwriteobject(); Q

9 13. Given: import java.io.*; class Player { Player() { System.out.print("p"); class CardPlayer extends Player implements Serializable { CardPlayer() { System.out.print("c"); public static void main(string[] args) { CardPlayer c1 = new CardPlayer(); try { FileOutputStream fos = new FileOutputStream("play.txt"); ObjectOutputStream os = new ObjectOutputStream(fos); os.writeobject(c1); os.close(); FileInputStream fis = new FileInputStream("play.txt"); ObjectInputStream is = new ObjectInputStream(fis); CardPlayer c2 = (CardPlayer) is.readobject(); is.close(); catch (Exception x ) { What is the result? A. pc B. pcc C. pcp D. pcpc E. Compilation fails. F. An exception is thrown at runtime. 9

10 14. Given: bw is a reference to a valid BufferedWriter And the snippet: 15. BufferedWriter b1 = new BufferedWriter(new File("f")); 16. BufferedWriter b2 = new BufferedWriter(new FileWriter("f1")); 17. BufferedWriter b3 = new BufferedWriter(new PrintWriter("f2")); 18. BufferedWriter b4 = new BufferedWriter(new BufferedWriter(bw)); What is the result? A. Compilation succeeds. B. Compilation fails due only to an error on line 15. C. Compilation fails due only to an error on line 16. D. Compilation fails due only to an error on line 17. E. Compilation fails due only to an error on line 18. F. Compilation fails due to errors on multiple lines. 15. Given: import java.io.*; class Keyboard { public class Computer implements Serializable { private Keyboard k = new Keyboard(); public static void main(string[] args) { Computer c = new Computer(); c.storeit(c); void storeit(computer c) { try { ObjectOutputStream os = new ObjectOutputStream( new FileOutputStream("myFile")); 10

11 os.writeobject(c); os.close(); System.out.println("done"); catch (Exception x) {System.out.println("exc"); What is the result? (Choose all that apply.) A. exc B. done C. Compilation fails. D. Exactly one object is serialized. E. Exactly two objects are serialized. 16. Given: import java.io.*; class Directories { static String [] dirs = {"dir1", "dir2"; public static void main(string [] args) { for (String d : dirs) { // insert code 1 here File file = new File(path, args[0]); // insert code 2 here and that the invocation java Directories file2.txt is issued from a directory that has two subdirectories, "dir1" and "dir1", and that "dir1" has a file "file1.txt" and "dir2" has a file "file2.txt", and the output is "false true", which 11

12 set(s) of code fragments must be inserted? (Choose all that apply.) A. String path = d; System.out.print(file.exists() + " "); B. String path = d; System.out.print(file.isFile() + " "); C. String path = File.separator + d; System.out.print(file.exists() + " "); D. String path = File.separator + d; System.out.print(file.isFile() + " "); 17. Given: import java.io.*; public class TestSer { public static void main(string[] args) { SpecialSerial s = new SpecialSerial(); try { ObjectOutputStream os = new ObjectOutputStream( new FileOutputStream("myFile")); os.writeobject(s); os.close(); System.out.print(++s.z + " "); ObjectInputStream is = new ObjectInputStream( new FileInputStream("myFile")); SpecialSerial s2 = (SpecialSerial)is.readObject(); is.close(); System.out.println(s2.y + " " + s2.z); catch (Exception x) {System.out.println("exc"); 12

13 class SpecialSerial implements Serializable { transient int y = 7; static int z = 9; Which are true? (Choose all that apply.) A. Compilation fails. B. The output is C. The output is D. The output is E. The output is F. In order to alter the standard deserialization process you would override the readobject() method in SpecialSerial. G. In order to alter the standard deserialization process you would override the defaultreadobject() method in SpecialSerial. SECTION-2 Q: 01 Given: 11. public class Test { 12. public static void main(string [] args) { 13. int x = 5; 14. boolean b1 = true; 15. boolean b2 = false; if ((x == 4) &&!b2 ) 18. System.out.print("1 "); 19. System.out.print("2 "); 20. if ((b2 = true) && b1 ) 21. System.out.print("3 ");

14 What is the result? A. 2 B. 3 C. 1 2 D. 2 3 E F. Compilation fails. G. An exception is thrown at runtime. Q: 02 Given the command line java Pass2 and: 15. public class Pass2 { 16. public void main(string [] args) { 17. int x = 6; 18. Pass2 p = new Pass2(); 19. p.dostuff(x); 20. System.out.print(" main x = " + x); void dostuff(int x) { 24. System.out.print(" dostuff x = " + x++); What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. dostuff x = 6 main x =

15 D. dostuff x = 6 main x = 7 E. dostuff x = 7 main x = 6 F. dostuff x = 7 main x = 7 Q: 03 Given: 13. public class Pass { 14. public static void main(string [] args) { 15. int x = 5; 16. Pass p = new Pass(); 17. p.dostuff(x); 18. System.out.print(" main x = " + x); void dostuff(int x) { 22. System.out.print(" dostuff x = " + x++); What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. dostuff x = 6 main x = 6 D. dostuff x = 5 main x = 5 E. dostuff x = 5 main x = 6 F. dostuff x = 6 main x = 5 Question: 04 Given: 42. public class ClassA { 43. public int getvalue() { 44.int value=0; 15

16 45. boolean setting = true; 46. String title= Hello ; 47. if (value (setting && title == Hello )) { return 1; 48. if (value == 1 & title.equals( Hello )) { return 2; And: 70. ClassA a = new ClassA(); 71. a.getvalue(); What is the result? A. 1 B. 2 C. Compilation fails. D. The code runs with no output. E. An exception is thrown at runtime. 5. Given: class Hexy { public static void main(string[] args) { Integer i = 42; String s = (i<40)?"life":(i>50)?"universe":"everything"; System.out.println(s); What is the result? A. null B. life C. universe D. everything E. Compilation fails. F. An exception is thrown at runtime. 16

17 6. Given: 1. class Example { 2. public static void main(string[] args) { 3. Short s = 15; 4. Boolean b; 5. // insert code here Which, inserted independently at line 5, will compile? (Choose all that apply.) A. b = (Number instanceof s); B. b = (s instanceof Short); C. b = s.instanceof(short); D. b = (s instanceof Number); E. b = s.instanceof(object); F. b = (s instanceof String); 1.What is the expected output? public static void main(string[] args) { boolean stmt1 = "champ" == "champ"; SECTION-3 boolean stmt2 = new String("champ").equals(new String("champ")); boolean stmt3 = "champ".tostring()=="champ"; System.out.println(stmt1 && stmt2 && stmt3); Please choose only one answer: A>True B>False 2. Select the common methods, which are defined for both type String and type StringBuffer? Please choose all the answers that apply: 17

18 A> tostring() B> length() C> append(string) D> trim() E> equals(object) 3.Which of the statements would evaluate to true? public class Tester { public static void main(string[] args) { StringBuffer sb = new StringBuffer("javachamp"); String s = new String("javachamp"); boolean stmt1 = s.equals(sb) ; boolean stmt2 = sb.equals(s) ; boolean stmt3 = sb.tostring() == s ; boolean stmt4 = sb.tostring().equals(s) ; boolean stmt5 = s.equals(sb.tostring()) ; Please choose all the answers that apply: A> stmt1 B> stmt2 C> stmt3 D> stmt4 E> stmt5 4.Which of the statements will evaluate to true? Author: JavaChamp Team public class Tester { public static void main(string[] args) { StringBuffer sb1 = new StringBuffer("javachamp"); StringBuffer sb2 = new StringBuffer("javachamp"); boolean stmt1 =sb1.equals(sb2) ; boolean stmt2 = sb1 == sb2; String s1 = new String("javachamp"); String s2 = new String("javachamp"); boolean stmt3 = s1.equals(s2); boolean stmt4 = s1 == s2; Please choose only one answer: A> stmt1 B> stmt2 18

19 C> stmt3 D> stmt4 5.What is the expected output? public static void main(string args []) { String stmt = null; System.out.print(null+stmt); System.out.print(stmt+null); Please choose only one answer: A> RuntimeException is thrown because of the first print statement B> RuntimeException is thrown because of the second print statement C> nullnullnullnull D> nullnull E> compilation error 6. What is the result of compiling and running the following code? public static void main(string[] args) { StringBuffer buffer1 = new StringBuffer("javachamp"); StringBuffer buffer2 = new StringBuffer(buffer1); if (buffer1.equals(buffer2)) System.out.println("true"); else System.out.println("false"); Please choose only one answer: A> true B>false 7. What is the result of compiling and running the following code? public static void main(string[] args) { String s1 = null; String s2 = null; if (s1 == s2) System.out.print("A"); if (s1.equals(s2)) System.out.print("B"); Please choose only one answer: A> "AB" will be printed B> "A" will be printed followed be a NullPointerException thrown 19

20 C> "B" will be printed D> No output is produced E> Author: Yasser Ibrahim 8.Which of the following methods can be invoked by an object of Pattern class? Please choose all the answers that apply: A> compile B> matches C> group D> tostring 9. What is the result of compiling and running the following program? public class Tester { public static void main(string[] args) { String a = "javachamp"; String b = "javachamp"; String c = new String("javachamp"); System.out.print(a==b); System.out.print(a==c); System.out.print(b.equals(c)); System.out.print(b.equals(a)); Please choose only one answer: A> Compilation error B> falsefalsetruetrue C> truetruetruetrue D> truefalsetruetrue 20

21 10. What is the result of compiling and running the following code? public class Tester { public static void main(string[] args) { String stmt = "JavaChamp is here to help you"; for (String token : stmt.split("//s")) { System.out.print(token + " "); Please choose only one answer: A> JavaChamp is here to help you B> JavaChamp i here to help you C> No output is produced D> Compilation error 21

Oracle 1z Java Standard Edition 5 Programmer Certified Professional Upgrade Exam. Practice Test. Version: https://certkill.

Oracle 1z Java Standard Edition 5 Programmer Certified Professional Upgrade Exam. Practice Test. Version: https://certkill. Oracle 1z0-854 Java Standard Edition 5 Programmer Certified Professional Upgrade Exam Practice Test Version: 14.20 QUESTION NO: 1 Oracle 1z0-854: Practice Exam 20. public class CreditCard { 21. 22. private

More information

Exam Questions 1z0-854

Exam Questions 1z0-854 Exam Questions 1z0-854 Java Standard Edition 5 Programmer Certified Professional Upgrade Exam https://www.2passeasy.com/dumps/1z0-854/ 4.Which three statements concerning the use of the java.io.serializable

More information

String temp [] = {"a", "b", "c"}; where temp[] is String array.

String temp [] = {a, b, c}; where temp[] is String array. SCJP 1.6 (CX-310-065, CX-310-066) Subject: String, I/O, Formatting, Regex, Serializable, Console Total Questions : 57 Prepared by : http://www.javacertifications.net SCJP 6.0: String,Files,IO,Date and

More information

itexamdump 최고이자최신인 IT 인증시험덤프 일년무료업데이트서비스제공

itexamdump 최고이자최신인 IT 인증시험덤프  일년무료업데이트서비스제공 itexamdump 최고이자최신인 IT 인증시험덤프 http://www.itexamdump.com 일년무료업데이트서비스제공 Exam : 1Z0-854 Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam Vendors : Oracle Version : DEMO Get Latest

More information

What is Serialization?

What is Serialization? Serialization 1 Topics What is Serialization? What is preserved when an object is serialized? Transient keyword Process of serialization Process of deserialization Version control Changing the default

More information

Exam : 1Z Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam. Version : Demo

Exam : 1Z Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam. Version : Demo Exam : 1Z0-854 Title : Java Standard Edition 5 Programmer Certified Professional Upgrade Exam Version : Demo 1.Given: 20. public class CreditCard { 21. 22. private String cardid; 23. private Integer limit;

More information

RZQ 12/19/2008 Page 1 of 11

RZQ 12/19/2008 Page 1 of 11 Q: 121 Given: 10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here Which code, inserted at line 14, allows the Sprite class to compile?

More information

Input, Output and Exceptions. COMS W1007 Introduction to Computer Science. Christopher Conway 24 June 2003

Input, Output and Exceptions. COMS W1007 Introduction to Computer Science. Christopher Conway 24 June 2003 Input, Output and Exceptions COMS W1007 Introduction to Computer Science Christopher Conway 24 June 2003 Input vs. Output We define input and output from the perspective of the programmer. Input is data

More information

Exceptions Binary files Sequential/Random access Serializing objects

Exceptions Binary files Sequential/Random access Serializing objects Advanced I/O Exceptions Binary files Sequential/Random access Serializing objects Exceptions No matter how good of a programmer you are, you can t control everything. Other users Available memory File

More information

Job Migration. Job Migration

Job Migration. Job Migration Job Migration The Job Migration subsystem must provide a mechanism for executable programs and data to be serialized and sent through the network to a remote node. At the remote node, the executable programs

More information

For more details on SUN Certifications, visit

For more details on SUN Certifications, visit Exception Handling For more details on SUN Certifications, visit http://sunjavasnips.blogspot.com/ Q: 01 Given: 11. public static void parse(string str) { 12. try { 13. float f = Float.parseFloat(str);

More information

Name:... ID:... class A { public A() { System.out.println( "The default constructor of A is invoked"); } }

Name:... ID:... class A { public A() { System.out.println( The default constructor of A is invoked); } } KSU/CCIS/CS CSC 113 Final exam - Fall 12-13 Time allowed: 3:00 Name:... ID:... EXECRICE 1 (15 marks) 1.1 Write the output of the following program. Output (6 Marks): class A public A() System.out.println(

More information

CN208 Introduction to Computer Programming

CN208 Introduction to Computer Programming CN208 Introduction to Computer Programming Lecture #11 Streams (Continued) Pimarn Apipattanamontre Email: pimarn@pimarn.com 1 The Object Class The Object class is the direct or indirect superclass of every

More information

Basic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO)

Basic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO) I/O and Scannar Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 I/O operations Three steps:

More information

d. If a is false and b is false then the output is "ELSE" Answer?

d. If a is false and b is false then the output is ELSE Answer? Intermediate Level 1) Predict the output for the below code: public void foo( boolean a, boolean b) if( a ) System.out.println("A"); if(a && b) System.out.println( "A && B"); if (!b ) System.out.println(

More information

SECTION-1 Q.1.Which two code fragments are most likely to cause a StackOverflowError? (Choose two.)

SECTION-1 Q.1.Which two code fragments are most likely to cause a StackOverflowError? (Choose two.) SECTION-1 Q.1.Which two code fragments are most likely to cause a StackOverflowError? (Choose two.) A. int []x = 1,2,3,4,5; for(int y = 0; y < 6; y++) System.out.println(x[y]); B. staticint[] x = 7,6,5,4;

More information

Data Structures. 03 Streams & File I/O

Data Structures. 03 Streams & File I/O David Drohan Data Structures 03 Streams & File I/O JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN 0132162709 2012 Pearson Education, Inc., Upper Saddle River, NJ.

More information

12% of course grade. CSCI 201L Final - Written Fall /7

12% of course grade. CSCI 201L Final - Written Fall /7 12% of course grade 1. Interfaces and Inheritance Does the following code compile? If so, what is the output? If not, why not? Explain your answer. (1.5%) interface I2 { public void meth1(); interface

More information

1.Which four options describe the correct default values for array elements of the types indicated?

1.Which four options describe the correct default values for array elements of the types indicated? 1.Which four options describe the correct default values for array elements of the types indicated? 1. int -> 0 2. String -> "null" 3. Dog -> null 4. char -> '\u0000' 5. float -> 0.0f 6. boolean -> true

More information

Exam : Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0. Version : Demo

Exam : Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0. Version : Demo Exam : 310-055 Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0 Version : Demo 1.Given: 10. class One { 11. void foo() {} 12. } 13. class Two extends One { 14. //insert method here 15. }

More information

School of Informatics, University of Edinburgh

School of Informatics, University of Edinburgh CS1Ah Lecture Note 29 Streams and Exceptions We saw back in Lecture Note 9 how to design and implement our own Java classes. An object such as a Student4 object contains related fields such as surname,

More information

Oracle 1Z Java Standard Edition 5 Programmer Certified Professional.

Oracle 1Z Java Standard Edition 5 Programmer Certified Professional. Oracle 1Z0-853 Java Standard Edition 5 Programmer Certified Professional https://killexams.com/pass4sure/exam-detail/1z0-853 QUESTION: 351 12. NumberFormat nf = NumberFormat.getInstance(); 13. nf.setmaximumfractiondigits(4);

More information

Lecture 7. File Processing

Lecture 7. File Processing Lecture 7 File Processing 1 Data (i.e., numbers and strings) stored in variables, arrays, and objects are temporary. They are lost when the program terminates. To permanently store the data created in

More information

JAVA Programming Language Homework VI: Threads & I/O

JAVA Programming Language Homework VI: Threads & I/O JAVA Programming Language Homework VI: Threads & I/O ID: Name: 1. When comparing java.io.bufferedwriter to java.io.filewriter, which capability exists as a method in only one of the two? A. Closing the

More information

Module 4 - 异常和断言 一 选择题 :

Module 4 - 异常和断言 一 选择题 : 一 选择题 : Question 1 Click the Exhibit button. 10. public class ClassA { 11. public void methoda() { 12. ClassB classb = new ClassB(); 13. classb.getvalue(); 14. } 15. } And: 20. class ClassB { 21. public

More information

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PASS4TEST. IT Certification Guaranteed, The Easy Way!  We offer free update service for one year PASS4TEST IT Certification Guaranteed, The Easy Way! \ We offer free update service for one year Exam : 310-055 Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0 Vendors : SUN Version : DEMO

More information

Java file manipulations

Java file manipulations Java file manipulations 1 Categories of Java errors We learn that there are three categories of Java errors : Syntax error Runtime error Logic error. A Syntax error (compiler error) arises because a rule

More information

Advanced Programming Methods. Seminar 12

Advanced Programming Methods. Seminar 12 Advanced Programming Methods Seminar 12 1. instanceof operator 2. Java Serialization Overview 3. Discuss how we can serialize our ToyLanguage interpreter. Please discuss the implementation of different

More information

Previous to Chapter 7 Files

Previous to Chapter 7 Files Previous to Chapter 7 Files Recall Scanner from Part I notes. A scanner object can reference a text file Scanner f = new Scanner(new File("file name goes here")); Scanner methods can be applied to reading

More information

Compile error. 2. A run time error occurs when the program runs and is caused by a number of reasons, such as dividing by zero.

Compile error. 2. A run time error occurs when the program runs and is caused by a number of reasons, such as dividing by zero. (טיפול בשגיאות) Exception handling We learn that there are three categories of errors : Syntax error, Runtime error and Logic error. A Syntax error (compiler error) arises because a rule of the language

More information

Object-Oriented Programming in the Java language

Object-Oriented Programming in the Java language Object-Oriented Programming in the Java language Part 5. Exceptions. I/O in Java Yevhen Berkunskyi, NUoS eugeny.berkunsky@gmail.com http://www.berkut.mk.ua Exceptions Exceptions in Java are objects. All

More information

Exam Actual. Higher Quality. Better Service! QUESTION & ANSWER

Exam Actual. Higher Quality. Better Service! QUESTION & ANSWER Higher Quality Better Service! Exam Actual QUESTION & ANSWER Accurate study guides, High passing rate! Exam Actual provides update free of charge in one year! http://www.examactual.com Exam : 310-056 Title

More information

Exam Questions 1z0-853

Exam Questions 1z0-853 Exam Questions 1z0-853 Java Standard Edition 5 Programmer Certified Professional Exam https://www.2passeasy.com/dumps/1z0-853/ 1.Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One

More information

CSE1720. General Info Continuation of Chapter 9 Read Chapter 10 for next week. Second level Third level Fourth level Fifth level

CSE1720. General Info Continuation of Chapter 9 Read Chapter 10 for next week. Second level Third level Fourth level Fifth level CSE1720 Click to edit Master Week text 08, styles Lecture 13 Second level Third level Fourth level Fifth level Winter 2014! Thursday, Feb 27, 2014 1 General Info Continuation of Chapter 9 Read Chapter

More information

Prep4Cram. Latest IT Exam Prep Training and Certification cram

Prep4Cram.   Latest IT Exam Prep Training and Certification cram Prep4Cram http://www.prep4cram.com Latest IT Exam Prep Training and Certification cram Exam : 310-056 Title : Sun Certified Programmer for J2SE 5.0 - Upgrade Vendors : SUN Version : DEMO Get Latest & Valid

More information

Exceptions and Working with Files

Exceptions and Working with Files Exceptions and Working with Files Creating your own Exceptions. You have a Party class that creates parties. It contains two fields, the name of the host and the number of guests. But you don t want to

More information

Tutorial 8 Date: 15/04/2014

Tutorial 8 Date: 15/04/2014 Tutorial 8 Date: 15/04/2014 1. What is wrong with the following interface? public interface SomethingIsWrong void amethod(int avalue) System.out.println("Hi Mom"); 2. Fix the interface in Question 2. 3.

More information

CMPSCI 187: Programming With Data Structures. Lecture #24: Files and a Case Study David Mix Barrington 2 November 2012

CMPSCI 187: Programming With Data Structures. Lecture #24: Files and a Case Study David Mix Barrington 2 November 2012 CMPSCI 187: Programming With Data Structures Lecture #24: Files and a Case Study David Mix Barrington 2 November 2012 Files and a Case Study Volatile and Non-Volatile Storage Storing and Retrieving Objects

More information

Certification In Java Language Course Course Content

Certification In Java Language Course Course Content Introduction Of Java * What Is Java? * How To Get Java * A First Java Program * Compiling And Interpreting Applications * The JDK Directory Structure Certification In Java Language Course Course Content

More information

COMP-202 Unit 9: Exceptions

COMP-202 Unit 9: Exceptions COMP-202 Unit 9: Exceptions Course Evaluations Please do these. -Fast to do -Used to improve course for future. (Winter 2011 had 6 assignments reduced to 4 based on feedback!) 2 Avoiding errors So far,

More information

Today. Book-keeping. File I/O. Subscribe to sipb-iap-java-students. Inner classes. Debugging tools

Today. Book-keeping. File I/O. Subscribe to sipb-iap-java-students. Inner classes.  Debugging tools Today Book-keeping File I/O Subscribe to sipb-iap-java-students Inner classes http://sipb.mit.edu/iap/java/ Debugging tools Problem set 1 questions? Problem set 2 released tomorrow 1 2 So far... Reading

More information

public class Test { static int age; public static void main (String args []) { age = age + 1; System.out.println("The age is " + age); }

public class Test { static int age; public static void main (String args []) { age = age + 1; System.out.println(The age is  + age); } Question No :1 What is the correct ordering for the import, class and package declarations when found in a Java class? 1. package, import, class 2. class, import, package 3. import, package, class 4. package,

More information

1.00 Lecture 30. Sending information to a Java program

1.00 Lecture 30. Sending information to a Java program 1.00 Lecture 30 Input/Output Introduction to Streams Reading for next time: Big Java 15.5-15.7 Sending information to a Java program So far: use a GUI limited to specific interaction with user sometimes

More information

Each command-line argument is placed in the args array that is passed to the static main method as below :

Each command-line argument is placed in the args array that is passed to the static main method as below : 1. Command-Line Arguments Any Java technology application can use command-line arguments. These string arguments are placed on the command line to launch the Java interpreter after the class name: public

More information

File Processing in Java

File Processing in Java What is File I/O? File Processing in Java I/O is an abbreviation for input and output. Input is data coming in at runtime. Input come sin through a mouse, keyboard, touchscreen, microphone and so on. Output

More information

Lara Technologies Special-Six Test

Lara Technologies Special-Six Test Flow control Part-1 Q: 01 Given: 10. public class Bar 11. static void foo( int... x ) 12. // insert code here 13. 14. Which two code fragments, inserted independently at line 12, will allow the class to

More information

FILE I/O IN JAVA. Prof. Chris Jermaine

FILE I/O IN JAVA. Prof. Chris Jermaine FILE I/O IN JAVA Prof. Chris Jermaine cmj4@cs.rice.edu 1 Our Simple Java Programs So Far Aside from screen I/O......when they are done, they are gone They have no lasting effect on the world When the program

More information

Programmierpraktikum

Programmierpraktikum Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 21 05/07/2012 10:31 AM Input / Output Streams 2 of 21 05/07/2012 10:31 AM Java I/O streams

More information

Training topic: OCPJP (Oracle certified professional Java programmer) or SCJP (Sun certified Java programmer) Content and Objectives

Training topic: OCPJP (Oracle certified professional Java programmer) or SCJP (Sun certified Java programmer) Content and Objectives Training topic: OCPJP (Oracle certified professional Java programmer) or SCJP (Sun certified Java programmer) Content and Objectives 1 Table of content TABLE OF CONTENT... 2 1. ABOUT OCPJP SCJP... 4 2.

More information

Chapter 10. IO Streams

Chapter 10. IO Streams Chapter 10 IO Streams Java I/O The Basics Java I/O is based around the concept of a stream Ordered sequence of information (bytes) coming from a source, or going to a sink Simplest stream reads/writes

More information

JOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide

JOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide Module 10 I/O Fundamentals Objectives Upon completion of this module, you should be able to: Write a program that uses command-line arguments and system properties Examine the Properties class Construct

More information

For more details on SUN Certifications, visit

For more details on SUN Certifications, visit Java.lang Package For more details on SUN Certifications, visit http://sunjavasnips.blogspot.com/ Q:01 Given: public class Person { private String name, comment; private int age; public Person(String n,

More information

Birkbeck (University of London) Software and Programming 1 In-class Test Mar 2018

Birkbeck (University of London) Software and Programming 1 In-class Test Mar 2018 Birkbeck (University of London) Software and Programming 1 In-class Test 2.1 22 Mar 2018 Student Name Student Number Answer ALL Questions 1. What output is produced when the following Java program fragment

More information

CS 251 Intermediate Programming Java I/O Streams

CS 251 Intermediate Programming Java I/O Streams CS 251 Intermediate Programming Java I/O Streams Brooke Chenoweth University of New Mexico Spring 2018 Basic Input/Output I/O Streams mostly in java.io package File I/O mostly in java.nio.file package

More information

Full file at Chapter 2 - Inheritance and Exception Handling

Full file at   Chapter 2 - Inheritance and Exception Handling Chapter 2 - Inheritance and Exception Handling TRUE/FALSE 1. The superclass inherits all its properties from the subclass. ANS: F PTS: 1 REF: 76 2. Private members of a superclass can be accessed by a

More information

Software 1 with Java. Recitation No. 7 (Java IO) May 29,

Software 1 with Java. Recitation No. 7 (Java IO) May 29, Software 1 with Java Recitation No. 7 (Java IO) May 29, 2007 1 The java.io package The java.io package provides: Classes for reading input Classes for writing output Classes for manipulating files Classes

More information

GlobalLogic Technical Question Paper

GlobalLogic Technical Question Paper GlobalLogic Technical Question Paper What is the output of the following code when compiled and run? Select two correct answers. public class Question01 { public static void main(string[] args){ int y=0;

More information

输 入输出相关类图. DataInput. DataOutput. java.lang.object. FileInputStream. FilterInputStream. FilterInputStream. FileOutputStream

输 入输出相关类图. DataInput. DataOutput. java.lang.object. FileInputStream. FilterInputStream. FilterInputStream. FileOutputStream 输 入 / 输出 杨亮 流的分类 输 入输出相关类图 OutputStream FileOutputStream DataInputStream ObjectOutputStream FilterInputStream PipedOutputStream DataOutput InputStream DataInputStream PrintStream ObjectInputStream PipedInputStream

More information

Class, Variable, Constructor, Object, Method Questions

Class, Variable, Constructor, Object, Method Questions Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx

More information

WOSO Source Code (Java)

WOSO Source Code (Java) WOSO 2017 - Source Code (Java) Q 1 - Which of the following is false about String? A. String is immutable. B. String can be created using new operator. C. String is a primary data type. D. None of the

More information

Java Programming Lecture 9

Java Programming Lecture 9 Java Programming Lecture 9 Alice E. Fischer February 16, 2012 Alice E. Fischer () Java Programming - L9... 1/14 February 16, 2012 1 / 14 Outline 1 Object Files Using an Object File Alice E. Fischer ()

More information

Chapter 10 Input Output Streams

Chapter 10 Input Output Streams Chapter 10 Input Output Streams ICT Academy of Tamil Nadu ELCOT Complex, 2-7 Developed Plots, Industrial Estate, Perungudi, Chennai 600 096. Website : www.ictact.in, Email : contact@ictact.in, Phone :

More information

Copying and Deleting Directories and Files. Reading and Writing JAR/ZIP Files. Java Object Persistence with Serialization

Copying and Deleting Directories and Files. Reading and Writing JAR/ZIP Files. Java Object Persistence with Serialization 4285book.fm Page 1 Thursday, December 4, 2003 6:44 PM File I/O SOLUTION 1 SOLUTION 2 SOLUTION 3 SOLUTION 4 SOLUTION 5 Copying and Deleting Directories and Files Reading and Writing JAR/ZIP Files Java Object

More information

Chapter 10. File I/O. Copyright 2016 Pearson Inc. All rights reserved.

Chapter 10. File I/O. Copyright 2016 Pearson Inc. All rights reserved. Chapter 10 File I/O Copyright 2016 Pearson Inc. All rights reserved. Streams A stream is an object that enables the flow of data between a program and some I/O device or file If the data flows into a program,

More information

Exceptions Handling Errors using Exceptions

Exceptions Handling Errors using Exceptions Java Programming in Java Exceptions Handling Errors using Exceptions Exceptions Exception = Exceptional Event Exceptions are: objects, derived from java.lang.throwable. Throwable Objects: Errors (Java

More information

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 9/e Copyright 1992-2012 by Pearson Education, Inc. All Rights Reserved. Data stored in variables and arrays is temporary It s lost when a local variable goes out of scope or when

More information

1.00 Lecture 31. Streams 2. Reading for next time: Big Java , The 3 Flavors of Streams

1.00 Lecture 31. Streams 2. Reading for next time: Big Java , The 3 Flavors of Streams 1.00 Lecture 31 Streams 2 Reading for next time: Big Java 18.6-18.8, 20.1-20.4 The 3 Flavors of Streams In Java, you can read and write data to a file: as text using FileReader and FileWriter as binary

More information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

Objects and Serialization

Objects and Serialization CS193j, Stanford Handout #18 Summer, 2003 Manu Kumar Objects and Serialization Equals boolean equals(object other) vs == For objects, a == b tests if a and b are the same pointer "shallow" semantics boolean

More information

Program Fundamentals

Program Fundamentals Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java

More information

Object Oriented Design with UML and Java. PART VIII: Java IO

Object Oriented Design with UML and Java. PART VIII: Java IO Object Oriented Design with UML and Java PART VIII: Java IO Copyright David Leberknight and Ron LeMaster. Version 2011 java.io.* & java.net.* Java provides numerous classes for input/output: java.io.inputstream

More information

Software 1. Java I/O

Software 1. Java I/O Software 1 Java I/O 1 The java.io package The java.io package provides: Classes for reading input Classes for writing output Classes for manipulating files Classes for serializing objects 2 Streams A stream

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

Java Exception. Wang Yang

Java Exception. Wang Yang Java Exception Wang Yang wyang@njnet.edu.cn Last Chapter Review A Notion of Exception Java Exceptions Exception Handling How to Use Exception User-defined Exceptions Last Chapter Review Last Chapter Review

More information

Software 1 with Java. Recitation No. 9 (Java IO) December 10,

Software 1 with Java. Recitation No. 9 (Java IO) December 10, Software 1 with Java Recitation No. 9 (Java IO) December 10, 2006 1 The java.io package The java.io package provides: Classes for reading input Classes for writing output Classes for manipulating files

More information

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets

More information

Midterm Exam CS 251, Intermediate Programming March 6, 2015

Midterm Exam CS 251, Intermediate Programming March 6, 2015 Midterm Exam CS 251, Intermediate Programming March 6, 2015 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible

More information

Java Programming Unit 9. Serializa3on. Basic Networking.

Java Programming Unit 9. Serializa3on. Basic Networking. Java Programming Unit 9 Serializa3on. Basic Networking. Serializa3on as per Wikipedia Serializa3on is the process of conver3ng a data structure or an object into a sequence of bits to store it in a file

More information

Stream Manipulation. Lecture 11

Stream Manipulation. Lecture 11 Stream Manipulation Lecture 11 Streams and I/O basic classes for file IO FileInputStream, for reading from a file FileOutputStream, for writing to a file Example: Open a file "myfile.txt" for reading FileInputStream

More information

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries

More information

CSE 331. Memento Pattern and Serialization

CSE 331. Memento Pattern and Serialization CSE 331 Memento Pattern and Serialization slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/ 1 Pattern: Memento a

More information

SUN. Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0

SUN. Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 SUN 310-055 Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 Download Full Version : https://killexams.com/pass4sure/exam-detail/310-055 C. Jar C D. Jar D E. Jar E Answer: A QUESTION:

More information

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class. Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone

More information

Basic Java IO Decorator pattern Advanced Java IO. Java IO - part 2 BIU OOP. BIU OOP Java IO - part 2

Basic Java IO Decorator pattern Advanced Java IO. Java IO - part 2 BIU OOP. BIU OOP Java IO - part 2 Java IO - part 2 BIU OOP Table of contents 1 Basic Java IO What do we know so far? What s next? 2 Example Overview General structure 3 Stream Decorators Serialization What do we know so far? What s next?

More information

Here is a hierarchy of classes to deal with Input and Output streams.

Here is a hierarchy of classes to deal with Input and Output streams. PART 15 15. Files and I/O 15.1 Reading and Writing Files A stream can be defined as a sequence of data. The InputStream is used to read data from a source and the OutputStream is used for writing data

More information

3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal

3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal APCS A Midterm Review You will have a copy of the one page Java Quick Reference sheet. This is the same reference that will be available to you when you take the AP Computer Science exam. 1. n bits can

More information

CS Week 11. Jim Williams, PhD

CS Week 11. Jim Williams, PhD CS 200 - Week 11 Jim Williams, PhD This Week 1. Exam 2 - Thursday 2. Team Lab: Exceptions, Paths, Command Line 3. Review: Muddiest Point 4. Lecture: File Input and Output Objectives 1. Describe a text

More information

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question) CS/B.TECH/CSE(New)/SEM-5/CS-504D/2013-14 2013 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

Input-Output and Exception Handling

Input-Output and Exception Handling Software and Programming I Input-Output and Exception Handling Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Outline Reading and writing text files Exceptions The try block catch and finally

More information

The Java I/O System. Binary I/O streams (ASCII, 8 bits) The decorator design pattern Character I/O streams (Unicode, 16 bits)

The Java I/O System. Binary I/O streams (ASCII, 8 bits) The decorator design pattern Character I/O streams (Unicode, 16 bits) The Java I/O System Binary I/O streams (ASCII, 8 bits) InputStream OutputStream The decorator design pattern Character I/O streams (Unicode, 16 bits) Reader Writer Comparing binary I/O to character I/O

More information

Become Java Certified

Become Java Certified Become Java Certified Ryan Allen LDS Church March 2012 Ryan.Allen@ldschurch.org 1 Education Personal Introduction Ryan Allen Bachelor of Computer Science, UofU, 2000 MBA, BYU, 2007 Work 1998 IBM DB2 Internship

More information

Text User Interfaces. Keyboard IO plus

Text User Interfaces. Keyboard IO plus Text User Interfaces Keyboard IO plus User Interface and Model Model: objects that solve problem at hand. User interface: interacts with user getting input from user giving output to user reporting on

More information

C17: File I/O and Exception Handling

C17: File I/O and Exception Handling CISC 3120 C17: File I/O and Exception Handling Hui Chen Department of Computer & Information Science CUNY Brooklyn College 10/24/2017 CUNY Brooklyn College 1 Outline Recap and issues Exception Handling

More information

Oracle Exam 1z0-809 Java SE 8 Programmer II Version: 6.0 [ Total Questions: 128 ]

Oracle Exam 1z0-809 Java SE 8 Programmer II Version: 6.0 [ Total Questions: 128 ] s@lm@n Oracle Exam 1z0-809 Java SE 8 Programmer II Version: 6.0 [ Total Questions: 128 ] Oracle 1z0-809 : Practice Test Question No : 1 Given: public final class IceCream { public void prepare() { public

More information

Active Learning: Streams

Active Learning: Streams Lecture 29 Active Learning: Streams The Logger Application 2 1 Goals Using the framework of the Logger application, we are going to explore three ways to read and write data using Java streams: 1. as text

More information

Streams and File I/O

Streams and File I/O Chapter 9 Streams and File I/O Overview of Streams and File I/O Text File I/O Binary File I/O File Objects and File Names Chapter 9 Java: an Introduction to Computer Science & Programming - Walter Savitch

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 1. JIT meaning a. java in time b. just in time c. join in time d. none of above CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 2. After the compilation of the java source code, which file is created

More information

Birkbeck (University of London) Software and Programming 1 In-class Test Mar Answer ALL Questions

Birkbeck (University of London) Software and Programming 1 In-class Test Mar Answer ALL Questions Birkbeck (University of London) Software and Programming 1 In-class Test 2.1 16 Mar 2017 Student Name Student Number Answer ALL Questions 1. What output is produced when the following Java program fragment

More information