JAVA test on P4
- Question 1. How much does the following block have?
String greeting = 'Hello';
int k = greeting.length ();
System.out.print (k);- 4
- 5
- 6
- 7
-
- 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
- There is no such command
-
- 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);- 4
- 5
- 6
- Compilation error
-
- Question 4. In the following special types of real numbers, which type is correct?
- Ocean infinity
- Infinity
- NaN
- All 3 values above
-
- Question 5. In Java, what type of char represents the code set below?
- UTF-8
- UTF-16
- UTF-32
- All the above code
-
- Question 6. The default value of a variable of type char is?
- u0000
- uFFFF
- OF
- OX
-
- Question 7. What are the following two statements?
String greetings = 'Hello';
String s = greetings.substring (0.3);- Hell
- Hel
- ello
- Hello
-
- Question 8. What are the following two statements?
String greetings = 'Hello'
String s = greetings.substring (0.3);- Hell
- Hel
- Wrong command
- Hello
-
- 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
-
Is a data type in java
- All is wrong
-
- Question 11. How many types of access are there in JAVA?
- first
- 2
- 3
- 4
-
- 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.
-
5 ★ | 1 Vote
Test on JAVA test P5