单选题switch (i) {  default:   System.out.printIn(“Hello”);   }  What is the acceptable type for the variable i?()AByteBLongCFloatDDoubleEObjectFA and BGC and D

题目
单选题
switch (i) {  default:   System.out.printIn(“Hello”);   }  What is the acceptable type for the variable i?()
A

 Byte

B

 Long

C

 Float

D

 Double

E

 Object

F

 A and B

G

 C and D


相似考题
参考答案和解析
正确答案: E
解析: 暂无解析
更多“单选题switch (i) {  default:   System.out.printIn(“Hello”);   }  What is the acceptable type for the variable i?()A  ByteB  LongC  FloatD  DoubleE  ObjectF  A and BG  C and D”相关问题
  • 第1题:

    switch(i){default:System.out.printIn(Hello”);}Whatistheacceptabletypeforthevariablei?()

    A.Byte

    B.Long

    C.Float

    D.Double

    E.Object

    F.AandB

    G.CandD


    参考答案:A

  • 第2题:

    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”


    参考答案:A

  • 第3题:

    switch(i){default:310-025LeadingthewayinITtestingandcertificationtools,www.testking.com-27-System.out.printIn(Hello”);}Whatarethetwoacceptabletypesforthevariablei?()

    A.Char

    B.Byte

    C.Float

    D.Double

    E.Object


    参考答案:A, B

  • 第4题:

    有以下程序 main() {int i; for(i=0;i<3;i++) switch(i) { case0:printf("%d",i); case2:printf("%d",i); default:printf("%d",i); } } 程序运行后的输出结果是

    A.22111

    B.21021

    C.122

    D.12


    正确答案:C
    解析:程序中for循环了三次,第一次i=0,执行switch语句中case0:分支,直到遇到default语句,退出switch,这里共执行了三个输出语句分别输出0,0,0,第二次循环i=1,switch语句中没有匹配的分支,故只执行default语句输出1,退出switch语句;第三次循环i=2,从switch语句中的case2:开始执行,共执行了两个输出语句输出2、2。最后输出的结果为000122。

  • 第5题:

    有以下程序 main() { int i; for(i=0;<3;i++) switch(i) { csse 1: printf("%d",i); case 2: printf("%d",i); default: printf("%d",i); } } 执行后输出结果是

    A.11122

    B.12

    C.12020

    D.120


    正确答案:A
    解析:for循环执行了3次,第一次时i的值为0,执行其后的switch语句,没有匹配的case,执行default语句后的printf语句,输出为0;第二次循环时i的值为1,执行其后的switch语句,与第一个case分支匹配,执行其后的printf语句,输出1,由于没有遇到break语句,所以一直向下执行,又输出了两个1,第三次循环时i值为2,执行其后的switch语句,同理输出两个2。

  • 第6题:

    #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”);

    }


    正确答案:
    4.e C pr*am

  • 第7题:

    A:Hello,()B:WherecanIbuysomestampsC://Atthestampcounteroverthere.

    • A、Can I help you
    • B、May I help you
    • C、What can I do for you
    • D、Anything I can do for you

    正确答案:A,B,C,D

  • 第8题:

    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?()

    • A、 0
    • B、 1
    • C、 2
    • D、 4
    • E、 6

    正确答案:A,E

  • 第9题:

    int i = 1,j = -1;  switch (i) {  case 0, 1:j = 1;  case 2: j = 2;  default; j = 0;  }  System.out.println(“j=”+j);  What is the result?()  

    • A、 j = -1
    • B、 j = 0
    • C、 j = 1
    • D、 j = 2
    • E、 Compilation fails.

    正确答案:E

  • 第10题:

    switch (i) {  default:   System.out.printIn(“Hello”);   }  What is the acceptable type for the variable i?()  

    • A、 Byte
    • B、 Long
    • C、 Float
    • D、 Double
    • E、 Object
    • F、 A and B
    • G、 C and D

    正确答案:A

  • 第11题:

    多选题
    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? ()
    A

    Char

    B

    Byte

    C

    Float

    D

    Double

    E

    Object


    正确答案: E,D
    解析: 暂无解析

  • 第12题:

    单选题
    int i = 1,j = -1;  switch (i) {  case 0, 1:j = 1;  case 2: j = 2;  default; j = 0;  }  System.out.println(“j=”+j);  What is the result?()
    A

     j = -1

    B

     j = 0

    C

     j = 1

    D

     j = 2

    E

     Compilation fails.


    正确答案: E
    解析: 暂无解析

  • 第13题:

    switch(i){default:System.out.printIn(Hello”);)Whatarethetwoacceptabletypesforthevariablei?()

    A.Char

    B.Byte

    C.Float

    D.Double

    E.Object


    参考答案:A, B

  • 第14题:

    switch(x){default:System.out.println(“Hello”);}Whichtwoareacceptabletypesforx?()

    A.byte

    B.long

    C.char

    D.float

    E.Short

    F.Long


    参考答案:A, C

  • 第15题:

    有以下程序 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.22111

    B.21021

    C.122

    D.12


    正确答案:C

  • 第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


    正确答案:C
    当i=0时,执行switch语句,对应的执行case0,输出0,因为没有break,接着执行case2的语句,又输出一个0,接着执行default语句,再输出一个0,返回i++;i=1时,没有case语句,执行default语句,输出一个1,接着又返回i++;当i=2时执行case2和default语句分别输出一个2,此时又返回i++,i变为3,for循环不成立,终止,最后输出000122。

  • 第17题:

    以下程序的输出结果是( )。main(){ int i; for(i=0;i<3;i++) switch(i) { case 0:printf(&quo

    以下程序的输出结果是( )。

    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


    正确答案:C
    当i=0时,执行switch语句,对应的执行case0,输出0,因为没有break,接着执行case2的语句,又输出一个0,接着执行default语句,再输出一个0,返回i++;i=1时,没有case语句,执行default语句,输出一个1,接着又返回i++;当i=2时执行case2和default语句分别输出一个2,此时又返回i++,i变为3,for循环不成立,终止,最后输出000122。

  • 第18题:

    Hello, Peter. What do you do?()

    • A、I am fine. 
    • B、I am not sick. 
    • C、I am a student from Bonn University. 
    • D、I came from Bonn University.

    正确答案:C

  • 第19题:

    switch(x) {  default:  System.out.println(“Hello”);  }  Which two are acceptable types for x?() 

    • A、 byte
    • B、 long
    • C、 char
    • D、 float
    • E、 Short
    • F、 Long

    正确答案:A,C

  • 第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? ()

    • A、 Char
    • B、 Byte
    • C、 Float
    • D、 Double
    • E、 Object

    正确答案:A,B

  • 第21题:

    switch (i)  {  default:  System.out.printIn(“Hello”);  )   What are the two acceptable types for the variable i?()  

    • A、 Char
    • B、 Byte
    • C、 Float
    • D、 Double
    • E、 Object

    正确答案:A,B

  • 第22题:

    单选题
    switch (i)  {  default:  System.out.printIn(“Hello”);  }  What is the acceptable type for the variable i?()
    A

     Byte

    B

     Long

    C

     Float

    D

     Double

    E

     Object

    F

     A and B

    G

     C and D


    正确答案: F
    解析: 暂无解析

  • 第23题:

    多选题
    switch (i)  {  default:  System.out.printIn(“Hello”);  )   What are the two acceptable types for the variable i?()
    A

    Char

    B

    Byte

    C

    Float

    D

    Double

    E

    Object


    正确答案: C,B
    解析: 暂无解析

  • 第24题:

    多选题
    switch(x) {  default:  System.out.println(“Hello”);  }  Which two are acceptable types for x?()
    A

    byte

    B

    long

    C

    char

    D

    float

    E

    Short

    F

    Long


    正确答案: E,D
    解析: 暂无解析