JAVA test on P4

The multiple choice questions about Java programming will provide you with useful knowledge in the process you apply to learning as well as working with Java. Invite your reference.
  1. Question 1. How much does the following block have?
     String greeting = 'Hello'; 

    int k = greeting.length ();

    System.out.print (k);
    1. 4
    2. 5
    3. 6
    4. 7
  2. Question 2. What effect does str.charat (n) command do?
    1. Get any character in string str
    2. Get the string length str
    3. Get the character with the index number n in the string k
    4. There is no such command
  3. Question 3. How much is the following block of code when executing?
     char [] greet = new char [10]; 

    greet = 'Hello';

    k = greet.length ();

    System.out.print (k);
    1. 4
    2. 5
    3. 6
    4. Compilation error
  4. Question 4. In the following special types of real numbers, which type is correct?
    1. Ocean infinity
    2. Infinity
    3. NaN
    4. All 3 values ​​above
  5. Question 5. In Java, what type of char represents the code set below?
    1. UTF-8
    2. UTF-16
    3. UTF-32
    4. All the above code
  6. Question 6. The default value of a variable of type char is?
    1. u0000
    2. uFFFF
    3. OF
    4. OX
  7. Question 7. What are the following two statements?
     String greetings = 'Hello'; 

    String s = greetings.substring (0.3);
    1. Hell
    2. Hel
    3. ello
    4. Hello
  8. Question 8. What are the following two statements?
     String greetings = 'Hello' 

    String s = greetings.substring (0.3);
    1. Hell

    2. Hel
    3. Wrong command
    4. Hello
  9. Question 9. In the following two statements, what does the substring command do?
     String greetings = 'Hello'; 

    String s = greetings.substring (0.3);
    1. Retrieve the characters from index 0 position to index position 2 of the greetings string and put into s

      1. Change the first 3 characters of the greetings string
    2. Copy the string greetings into the string s
    3. Cut characters from position index 0 to index 3 and input s
  10. Question 10. What is enum type?
    1. A data type consisting of fields containing a fixed set of constants
      1. Is the data type that lists variables
    2. Is a data type in java

    3. All is wrong
  11. Question 11. How many types of access are there in JAVA?
    1. first
    2. 2
    3. 3
    4. 4
  12. Question 12. If you do not declare the keyword indicating the scope of access, what is the scope of access of the object?
    1. Can access from classes in the same package
    2. You can access objects from classes in the same package and subclasses in other packages
    3. Can access objects from other methods in that class

      1. Can access the object from any location of the program
  13. Question 13. What is the access scope of an object when declared private?
    1. Can be accessed anywhere in the program.

      1. Can be accessed from classes in the same package.
    2. Can be accessed from classes in the same package and subclasses in other packages

    3. Only accessible from other methods in that class

  14. Question 14. What is an object's access scope when declared protected?
      1. Can be accessed from any location in the program.
      1. Can be accessed from classes in the same package.
      1. Can be accessed from classes in the same package and subclasses in other packages.
      1. Only accessible from other methods in that class.
  15. Question 15. What is the access scope of an object when public declaration is made?
      1. Can be accessed from any location in the program.
      1. Can be accessed from classes in the same package.
      1. Can be accessed from classes in the same package and subclasses in other packages.
      1. Only accessible from other methods in that class.
5 ★ | 1 Vote