Search Header Logo

Adv Java Quiz 1

Authored by Omphile Mosingathi

Computers

University

Used 4+ times

Adv Java Quiz 1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a stream in Java?

A sequence of elements that can be processed sequentially

A type of data structure

A collection of objects

A type of exception

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which package provides the classes for handling streams in Java?

java.util

java.lang

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main purpose of byte streams in Java?

To handle characters

To handle primitive data types and files

To handle text files only

To handle large amounts of data in memory

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class is used for reading bytes from a file?

FileReader

BufferedReader

FileInputStream

DataInputStream

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class is used for writing bytes to a file?

FileWriter

BufferedWriter

FileOutputStream

DataOutputStream

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a FileInputStream object to read from a file named "example.txt"?

FileInputStream fis = new FileInputStream("example.txt");

FileInputStream fis = new FileInputStream(new File("example.txt"));

FileInputStream fis = new FileInputStream(new FileInputStream("example.txt"));

d) Both a and b

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method of FileInputStream reads the next byte of data?

readByte()

nextByte()

read()

getByte()

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers