TipsMake

Test on JAVA test P7

A set of multiple-choice questions about Java gives you useful knowledge for work and study. The set of questions below includes 10 sentences for you to experience.

  • Question 1. Which method is used to search a string in another string in Java's String class?
    • astIndexOf ()
      1. substring ()
      1. toString ()
    • No answer right
  • Question 2. In Java, what data type is an object's address or an array created in memory?
    • Primitive type
    • Reference type
    • Format
    • There is no right answer
  • Question 3. What is the function of the while loop?
    • Check the result of the boolean expression
    • Avoid conflict between inside and outside the switch
    • Repeat the command block to see if the condition is correct
    • No answer right
  • Question 4. Java provides a number of commands that change control flow based on conditions. Which command stops the operation of the inner lap and starts the next statement immediately after the block?
    • break
    • tiếp tục
    • thay đổi
    • jump
  • Question 5. Result = condition command? What does value1: value2 mean?
      1. If condition is true then result = value2, if condition is false, result = value1
    • If condition is true then result = value1, if condition is false then result = value2
    • There is no such command
    • If condition is true, the result will invert the value of value1 and value2
  • Question 6. Which command stops the current loop and starts the next loop?
    • tiếp tục
    • break
    • cease
    • end
  • Question 7. Which of the following statements is correct?
    • int [] a;
    • int a [];
    • int a [] = new int [10];
    • All 3 statements are correct
  • Question 8. How many changes of the array object reference and variable exist after executing the block?
     String [] students = new String [10]; 

    String studentName = 'Peter Parker';

    students [0] = studentName;

    studentName = null;
    • first
    • 2
    • 3
    • 4
  • Sentence 9. Assumption Rectangle class is defined and not false. When running, the program reported an error because:
     public class SomeWrong { 

    public static void main (String [] args) {

    MyRect Rectangle;

    myRect.width = 40;

    myRect.height = 50;

    System.out.println ('Standard delivery:' + myRect.area ());

    }

    }
    • MyRect has not been initialized yet
    • There is no processing method
    • There is no static keyword
    • The program is not wrong
  • Question 10. To inverse the value of a boolean variable, which operator do we use?
    • !
    • >>
    • <<
    • >>>

Discover more

tutorial multiple choice test JAVA programming eQuiz knowledge basic technical optimization language java programming
Isabella Humphrey

Share by

Isabella Humphrey
Update 24 May 2019