My Report

Java Programming Mock Test 8


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. FocusEvent is subclass of which of these classes?

Question 1 of 10

Question 2 of 10

2. What will be the output of the following Java program?

   
    class output
    {
        public static void main(String args[])
        { 
             StringBuffer c = new StringBuffer("Hello");
             System.out.println(c.length());
        }
    }

Question 2 of 10

Question 3 of 10

3. Which of these exception is thrown in cases when the file specified for writing is not found?

Question 3 of 10

Question 4 of 10

4. What will be the output of the following Java program if input given is 'abcqfghqbcd'?

 
    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 != 'q');
        }
    }

Question 4 of 10

Question 5 of 10

5. Which of these events is generated when the window is closed?

Question 5 of 10

Question 6 of 10

6. What is the Message is displayed in the applet made by the following Java program?

 
    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet
    {
        public void paint(Graphics g)
        {
            g.drawString("A Simple Applet", 20, 20);    
        }
    }

Question 6 of 10

Question 7 of 10

7. Which of these are integer constants of TextEvent class?

Question 7 of 10

Question 8 of 10

8. Which of the following matches nonword character using regular expression in java?

Question 8 of 10

Question 9 of 10

9. Which of these classes are used by character streams output operations?

Question 9 of 10

Question 10 of 10

10. What will be the output of the following Java program?

 
    import java.text.*;
    import java.util.*;
    class Date_formatting
    {	 
        public static void main(String args[])
        {
	    Date date = new Date();
	    SimpleDateFormat sdf;
            sdf = new SimpleDateFormat("mm:hh:ss");
            System.out.print(sdf.format(date));
        }	
    }

Note : The program is executed at 3 hour 55 minutes and 4 sec (24 hours time).

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.