Answer: B (there is a dot after option A 12, a comma in option C and no space in option D).
2. Let I, J, K and M be int variables with assignment. Which of the following expressions is a logical value?
a.i = = k & ampj+k & gt; =m b. i+k c. m++ d. m=i+j
Answer: a (only a is a logical expression)
3. After executing the following statement, the value of k is
int i=4,j=5,k=9,m = 5;
If (i & gtj||m, k) k++; else k-;
a. 10
There is something wrong with this topic ~ ~
4. After executing the following statement sequence, the value of k is
int i= 10,j= 18,k = 30
Switch (j-i)
{Case 8: k++;+;
Situation 9: k+= 2;
Case10: k+= 3;
Default: k/= j;
}
a.3 1
Answer: 2 (there is no line break after 2 (case 8, so every sentence in the switch will be executed once).
5. What's the matter? Answer: d
Class A is a collection of objects in the same object, and abstract class B is an abstract data type.
Class C is a compound data type, and Class D has 1 objects.
6. Which is correct? A: A.
A. 1 A program can contain multiple source files. B. 1 The source file can only have 1 classes.
C. 1 source files can have multiple public classes. D. 1 source files can only be used by 1 programs.
7. After executing the following statement sequence, the value of I is
int s= 1,I = 1;
While (I < = 4) {s * = I; i++; }
a.6 b. 4 c. 24 d. 5
Answer: D (I added 1 after the last execution of i=4)
8. What can go wrong?
1 public void modify() {
2 int I,j,k;
3i = 100;
4 while(I & gt; 0) {
5j = I * 2;
6 system. out.println (the value of "j" is "+j");
7k = k+ 1;
8i-;
9 }
10 }
Line 4, Line 6, Line 7 and Line 8
Answer: Line 7 (because K is not initialized in the program)
9. Give the following code:
Public personnel {
Static intarr [] = new int [10];
Public static void main (string a[])
{
system . out . println(arr[ 1]);
}
}
Which of the following statements is true about the above procedure?
Error during compilation;
(If s is lowercase in main(string ...), then this is the answer. )
It is correct when it is cheap, and it will produce errors when it runs;
Output zero; (If the s in the String is capitalized, the answer is this option. Arr[] is a class variable, not an instance variable, and can be called directly, so the output is 0.
The output is empty.
There are still some such questions in my Baidu space, which I collected myself for the intermediate JAVA exam. You can go and see _ if you are interested.