JAVA test on P4

  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

May be interested

  • Test on JAVA test on P9Test on JAVA test on P9
    unlike most common programming languages, instead of compiling the source code into machine code or interpreting source code when running, java is designed to compile the source code into bytecode, then bytecode will be run by the runtime environment. . to help you better understand this programming language, the following quiz of network administrator will give you lots of useful knowledge.
  • 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.