1.What does the following statement do? Scanner scanner =Scanner(new File(%u201C
ID: 3540649 • Letter: 1
Question
1.What does the following statement do?
Scanner scanner =Scanner(new File(%u201Ctest.txt%u201D));
A. Opens a binary file for input
B. Opens a binary file for output
C. Opens a text file for input
D. Opens a text file for output
2.For data hierarchy in java, which of the following is arranged in increasing size order?
A. field, bit, file, record
B. byte, file, database, record
C. byte, field, file, record
d.bit,field,record,file
3. When a ______method is running in an object, the object is locked so no other such method can run in that object at the same time.
A. Syncronized
B. shared
C. thread.
D.writable.
4. A program that launches a thread%u2019s execution by calling the Thread%u2019s ________method, which , in turn calls the_____method.
A. begin, execute
B. run, start
C. execute, begin
D. start, run
5. To catch an exception, the code that might throw the exception should be enclosed in a
A. Throws block
B. Catch block
C. Try block
D. Finally block
Explanation / Answer
1. C
The Scanner is used for taking input from keyboard, reading values from files etc..
2.D
Bit is the smallest data type available,and file occupies the max size
3.A
4.D
Start is like a constructor which is called when a thread is initiated, run has the desired code
5.C
The code that has to testes is kept in Try block and the exception output is placed in catch,finally Block
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.