Char
Byte
Float
Double
Object
第1题:
以下程序的输出结果是( )。 #include<iostream.h> void main() { int a(5),b(6),i(0),j(0); switch(a) { case 5:switch(b) { case 5:i++;break; case 6:j++;break; default:i++;j++; } case 6:i++; j++; break; default:i++;j++; } cout<<i<<","<<j<<endl; }
A.1,2
B.1,3
C.2,2
D.2,3
第2题:
A.Byte
B.Long
C.Float
D.Double
E.Object
F.AandB
G.CandD
第3题:
classsuper(publicintI=0;publicsuper(stringtext)(I=1))publicclasssubextendssuper(publicsub(stringtext)(i=2)publicstaticvoidmain(straingargs[])(subsub=newsub(Hello”);system.out.PrintIn(sub.i);))Whatistheresult?()
A.Compilationwillfail.
B.Compilationwillsucceedandtheprogramwillprint“0”
C.Compilationwillsucceedandtheprogramwillprint“1”
D.Compilationwillsucceedandtheprogramwillprint“2”
第4题:
编译和执行以下代码,输出结果是( )。 int i=1; switch (i) { case 0: System.out.print("zero,"); break; case 1: System.out.print("one,"); case 2: System.out.print("two,"); default: System.out.println("default"); }
A.one,
B.one,two,
C.one,two,default
D.default
第5题:
以下程序的输出结果是( )。
main()
{ int i;
for(i=0;i<3;i++)
switch(i)
{ case 0:printf("%d",i);
case 2:printf("%d",i);
default:printf("%d",i); }
}
A.000102
B.000020
C.000122
D.000111
第6题:
I shall be surprised if he does this the same way()I do.
第7题:
switch(x) { default: System.out.println(“Hello”); } Which two are acceptable types for x?()
第8题:
Given: 310-025 Leading the way in IT testing and certification tools, www.testking.com - 48 - public class foo { static String s; public static void main (Stringargs) { system.out.printIn (“s=” + s); } } What is the result?()
第9题:
switch (i) { default: System.out.printIn(“Hello”); ) What are the two acceptable types for the variable i?()
第10题:
The code compiles and “s=” is printed.
The code compiles and “s=null” is printed.
The code does not compile because string s is not initialized.
The code does not compile because string s cannot be referenced.
The code compiles, but a NullPointerException is thrown when toString is called.
第11题:
Char
Byte
Float
Double
Object
第12题:
byte
long
char
float
Short
Long
第13题:
下列程序的运行结果为【 】。
include<iostream.h>
void main(void)
{int i=10;
switch(i)
{ case 9:i=i+1;
case 10:i=i+1;
case 11:i=i+1;
default:i=i+1;
}
cout<<i<<endl;
}
第14题:
A.Char
B.Byte
C.Float
D.Double
E.Object
第15题:
A.Char
B.Byte
C.Float
D.Double
E.Object
第16题:
以下程序的输出结果是( )。 main { int i; for(i=0;i<3;i++) switch(i){case 0:printf("%d",i); case 2:printf("%d",i); default:printf("%d",i); } }
A.000102
B.000020
C.000122
D.000111
第17题:
#include
main()
{ char str[ ]=“The C program”,c;
int i;
for(i=2;(c=str[i])!=‘\0’;i++)
{ switch(c)
{ case ‘g’: ++i; break;
case ‘o’: continue;
default: printf(“%c”,c); continue;
}
printf(“*”);
}
printf(“\n”);
}
第18题:
A:Hello,()B:WherecanIbuysomestampsC://Atthestampcounteroverthere.
第19题:
int I=1, j=0 switch(i) { case 2: j+=6; case 4: j+=1; default: j +=2; case 0: j +=4; } What is the value of j at line 16?()
第20题:
switch (i) { default: 310-025 Leading the way in IT testing and certification tools,www.testking.com - 27 - System.out.printIn(“Hello”); } What are the two acceptable types for the variable i? ()
第21题:
switch (i) { default: System.out.printIn(“Hello”); } What is the acceptable type for the variable i?()
第22题:
Byte
Long
Float
Double
Object
A and B
C and D
第23题:
Char
Byte
Float
Double
Object
第24题:
0
1
2
4
6