PROGRAMMING IN JAVA Assignment 7 | NPTEL | Answer with Explanation | Multithreaded Programming MCQs
Test Your Java Fundamentals with a Challenging MCQ Assignment on " Multithreaded Programming IN jAVA " Sharpen your core Java skills with this engaging multiple-choice quiz (MCQ). Designed for beginners, this Assignment 7 assesses your understanding of fundamental Java concepts. Whether you're new to programming or refreshing your knowledge, this MCQ [Java Multithreaded Programming ] challenge is a perfect way to gauge your progress and identify areas for improvement.
Learn Java Programming for free with Computer Course - CompEduBox Android app. Share with your Friends
Which of these is a type of IO stream in Java?
a. Integer stream
b. Short stream
c. Byte stream
d. Character stream
Answer
c. Byte stream,d. Character stream
Java defines only two types of streams: Byte stream and character stream. Others are not streams.
Which of the following is a class in java.io package?
a. FileReaderb. ObjectInput
c. ObjectOutput
d. DataInput
Answer
a. FileReader
FileReader is a class in java.io package. All others are interfaces.
Consider the following program.
import java.io.*;
public class Question {
public static void main(String[] args)
{
try {
PrintWriter writer = new PrintWriter(System.out);
writer.write(64+'2');
writer.close();
}
catch (Exception e) {
System.out.println(e);
}
}
}
What will be the output if the above program is executed?
a. It will give compile-time error.
b. B
c. 66
d. r
Answer
d. r
The expression 64+'2' add 64 with 50(i.e, Ascii value of 2)=114 and print
the corresponding char, in this case, r.
Consider the following program.
import java.io.*;
public class files
{
public static void main(String args[])
{
File obj = new File("java/programm/2023");
System.out.print(obj.getName());
}
}
What is the output of the above code?
a. java/programm/2023b. java/programm/
c. java
d. 2023
Answer
d. 2023
Test by run.
0 Comments