GIAC
GSSP-JAVA · Question #83
Which of the following code snippets will read the eighth byte of the file wRead.txt into the variable str?
The correct answer is D. FileInputStream fis=new FileInputStream("wRead.txt"); fis.skip(7);int str=fis.read(). See the full explanation below for the reasoning.
Question
Which of the following code snippets will read the eighth byte of the file wRead.txt into the variable str?
Options
- ARandomAccessFile raf=new RandomAccessFile("wRead.txt"); raf.seek(8);int
- BFileInputStream fis=new FileInputStream("wRead.txt"); int str=fis.read(8);
- CFileInputStream fis=new FileInputStream("wRead.txt"); fis.skip(8);int str=fis.read();
- DFileInputStream fis=new FileInputStream("wRead.txt"); fis.skip(7);int str=fis.read();
How the community answered
(31 responses)- A16% (5)
- B3% (1)
- C10% (3)
- D71% (22)
Community Discussion
No community discussion yet for this question.