Input Output - Study Mode

[#71] What will be the output of the following Java program? import java.io.*
public class filesinputoutput
{
public static void main(String[] args)
{
String obj = "abc"
byte b[] = obj.getBytes()
ByteArrayInputStream obj1 = new ByteArrayInputStream(b)
for (int i = 0
i < 2
++ i)
{
int c
while((c = obj1.read()) != -1)
{
if(i == 0)
{
System.out.print(Character.toUpperCase((char)c))
obj2.write(1)
}
}
System.out.print(obj2)
}
}
}
Correct Answer

(D) AaBaaCaaa

[#72] What will be the output of the following Java program? import java.io.*
class Chararrayinput
{
public static void main(String[] args)
{
String obj = "abcdef"
int length = obj.length()
char c[] = new char[length]
obj.getChars(0, length, c, 0)
CharArrayReader input1 = new CharArrayReader(c)
CharArrayReader input2 = new CharArrayReader(c, 0, 3)
int i
try
{
while((i = input2.read()) != -1)
{
System.out.print((char)i)
}
}
catch (IOException e)
{
e.printStackTrace()
}
}
}
Correct Answer

(A) abc

[#73] What will be the output of the following Java program? import java.io.*
class Chararrayinput
{
public static void main(String[] args)
{
String obj = "abcdefgh"
int length = obj.length()
char c[] = new char[length]
obj.getChars(0, length, c, 0)
CharArrayReader input1 = new CharArrayReader(c)
CharArrayReader input2 = new CharArrayReader(c, 1, 4)
int i
int j
try
{
while((i = input1.read()) == (j = input2.read()))
{
System.out.print((char)i)
}
}
catch (IOException e)
{
e.printStackTrace()
}
}
}
Correct Answer

(D) none of the mentioned

[#74] What will be the output of the following Java program if input given is "abc'def/'egh"? class Input_Output
{
public static void main(String args[]) throws IOException
{
char c
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in))
do
{
c = (char) obj.read()
System.out.print(c)
} while(c != '\'')
}
}
Correct Answer

(A) abc'

[#75] What will be the output of the following Java program? class output
{
public static void main(String args[])
{
String a="hello i love java"
System.out.println(indexof('i')+" "+indexof('o')+" "+lastIndexof('i')+" "+lastIndexof('o') ))
}
}
Correct Answer

(A) 6 4 6 9