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.
Question 1. How much does the following block have?
String greeting = 'Hello'; int k = greeting.length (); System.out.print (k);
Question 2. What effect does str.charat (n) command do?
Get any character in string str
Get the string length str
Get the character with the index number n in the string k
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);
Question 4. In the following special types of real numbers, which type is correct?
Question 5. In Java, what type of char represents the code set below?
Question 6. The default value of a variable of type char is?
Question 7. What are the following two statements?
String greetings = 'Hello'; String s = greetings.substring (0.3);
Question 8. What are the following two statements?
String greetings = 'Hello' String s = greetings.substring (0.3);
Question 9. In the following two statements, what does the substring command do?
String greetings = 'Hello'; String s = greetings.substring (0.3);
Retrieve the characters from index 0 position to index position 2 of the greetings string and put into s
Change the first 3 characters of the greetings string
Copy the string greetings into the string s
Cut characters from position index 0 to index 3 and input s
Question 10. What is enum type?
A data type consisting of fields containing a fixed set of constants
Is the data type that lists variables
Question 11. How many types of access are there in JAVA?
Question 12. If you do not declare the keyword indicating the scope of access, what is the scope of access of the object?
Can access from classes in the same package
You can access objects from classes in the same package and subclasses in other packages
Can access objects from other methods in that class
Can access the object from any location of the program
Question 13. What is the access scope of an object when declared private?
Can be accessed anywhere in the program.
Can be accessed from classes in the same package.
Can be accessed from classes in the same package and subclasses in other packages
Only accessible from other methods in that class
Question 14. What is an object's access scope when declared protected?
Can be accessed from any location in the program.
Can be accessed from classes in the same package.
Can be accessed from classes in the same package and subclasses in other packages.
Only accessible from other methods in that class.
Question 15. What is the access scope of an object when public declaration is made?
Can be accessed from any location in the program.
Can be accessed from classes in the same package.
Can be accessed from classes in the same package and subclasses in other packages.
Only accessible from other methods in that class.