Home » Java Aptitude Que. & Ans.

Java Basic Input & Output Aptitude Questions and Answers



This section contains Aptitude Questions and Answers on Java Basic Input Output, Declaration etc.

List of Java Basic I/O Aptitude Questions

1) What will be the output of following program ?
public class Prg {
	public static void main(String args[]){
		System.out.print('A' + 'B');
	}
}
  1. AB
  2. 195
  3. 131
  4. Error

2) What will be the output of following program ?
public class Prg {
	public static void main(String args[]){
		System.out.print("A" + "B" + 'A');
	}
}
  1. ABA
  2. AB65
  3. Error
  4. AB

3) What will be the output of following program?
public class Prg {
	public static void main(String args[]){
		System.out.print(20+ 1.34f + "A" + "B");
	}
}
  1. 201.34AB
  2. 201.34fAB
  3. 21.34AB
  4. Error

4) What will be the output of following program?
public class Prg {
    public static void main(String[] args) {
        char [] str={'i','n','c','l','u','d','e','h','e','l','p'};
        System.out.println(str.toString());
    }
}
  1. includehelp
  2. Error
  3. [[email protected] (Memory Address)
  4. NULL

5) What will be the output of following program?
public class prg {
    public static void main(String[] args) {
        System.out.print("Hello");
        System.out.println("Guys!");
    }
}
  1. HelloGuys!
  2. Hello Guys!
  3. Hello
     Guys!
  4. Compile with a Warning






Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions


We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.