Test on JAVA test on P9

  1. Question 1. Which of the following program segments results?
     double a = 3, b = 5, c = 2; 

    double delta = b * b - 4 * a * c;

    if (delta <0) System.out.println ('Comforty virginity');

    else if (delta == 0) System.out.println ('Simple method');

    else System.out.println ('The method has two components');
    1. The perfect virgin
    2. The method has a sound
    3. The method has two options
    4. Compilation error
  2. Question 2. Which of the following program segments results?
     double a = 5, b = 3, c = 2; 

    double delta = b * b - 4 * a * c;

    if (delta <0) System.out.println ('Comforty virginity');

    else if (delta == 0) System.out.println ('Simple method');

    else System.out.println ('The method has two components');
    1. The perfect virgin
    2. The method has a sound
    3. The method has two options
    4. Compilation error
  3. Question 3. What is the following command to print the result:
     double x = 10000.0 / 3.0; 

    System.out.print (x);
    1. 3333.3333333333335
    2. 3333.33
    3. 3334.0
    4. 3332.0
  4. Question 4. Select the display format when executing the following statement:
     System.out.printf ('% tc', new Date ()); 
    1. Sun Dec 02 2010
    2. Sun Dec 02 17:26:19 ICT 2010
    3. Sunday December 02 2010
    4. Sunday December 05:26:00 ICT 2010
  5. Question 5. Select the display format when executing the following statement:
     System.out.printf ('% 1 $ s% 2 $ B% 2 $ te,% 2 $ Y', 'Due date:', new Date ()); 
    1. Due date: Dec 02 2010
    2. Sun Dec 02 2010
    3. Dec 02, 2010
    4. Due date: Dec 02, 2010
  6. Question 6. Which command is only used in case of nested loops?
    1. label
    2. jump
    3. array
    4. There is no right answer
  7. Question 7. Which of the following statements is true?
     a.char [] str; 

    b.char [] str = new char [15];

    char [] str = new ['A', 'B'];
    1. twelfth
    2. 2, 3
    3. 1, 3
    4. 1, 2, 3
  8. Question 8. Which of the following interface definitions is invalid?
    1. public interface inout {}
    2. protected interface inout {int i = 12;}
    3. interface inout {public final int MAX_INDEX = 100;}
    4. interface input {public void indl ();}
  9. Question 9. Given String str = 'univerity', which of the following commands takes the string 'univer' and binds string str1?
    1. String str1 = str.substring (0, 6);
    2. String str1 = str.substring (0, 5);
    3. String str1 = str.substring (1, 6);
    4. String str1 = str.substring (5);
  10. Question 10. Given str = 'Yunlin universtiy', what is the result of str.indexOf ('uni')?
    1. first
    2. 7
    3. 15
    4. Wrong command
5 ★ | 1 Vote

May be interested

  • Test on JAVA P10 testTest on JAVA P10 test
    multiple choice questions on java programming help you test your basic knowledge of this programming language. the set of questions includes 10 sentences to try.
  • Get familiar with NetBeans Java IDEGet familiar with NetBeans Java IDE
    in the following article, we will introduce you the most basic features of netbeans ide through a small test, which is to create the 'hello world' java application. and when finished, you will know the general knowledge and process when programming applications in ide ...
  • Testing test on JAVA P2Testing test on JAVA P2
    multiple choice questions on java programming help you test your basic knowledge of this programming language. the set of questions includes 10 sentences to try.
  • JAVA P8 test quizJAVA P8 test quiz
    if you are interested in learning about the java programming language, the following quiz of network administrator will provide you with a lot of useful knowledge for your learning.
  • Basic Java syntaxBasic Java syntax
    a java program can be defined as a collection of objects, communicating through calling each other's procedures. now we will look at the class, object, procedure and instance variable / instance variable to consider their meaning.
  • eQuiz - Multiple choice test on Java Swing PracticeeQuiz - Multiple choice test on Java Swing Practice
    welcome to the test series of tipsmake.com with topics related to the fields of information technology. and this time we will continue with the java swing practice test, a total of 13 questions will be answered with no time to answer each sentence. there will be some questions with many different answer options
  • What is JAVA file? How to open, edit and convert JAVA filesWhat is JAVA file?  How to open, edit and convert JAVA files
    a file with a .java extension is (or sometimes also used in .jav format) is a java source file written in the java programming language.
  • eQuiz - Multiple choice quiz about JAVAeQuiz - Multiple choice quiz about JAVA
    following are multiple-choice questions related to java programming language, there will be 23 questions in total with no answer for each time. let's get started!
  • Download and install Java on the computerDownload and install Java on the computer
    to program java on your computer, you need to install the java environment, this tutorial will show you how to download and install java on your computer.
  • Basic Java exercises, with sample decodingBasic Java exercises, with sample decoding
    to serve your java learning needs, tipsmake.com has synthesized some java exercises from many sources, including sample code (for some articles). hopefully it can be helpful to learn your java programming language.