单选题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


相似考题
更多“switch (i)  {  default:  System.out.printIn(“Hello”);  }  Wh”相关问题
  • 第1题:

    下列程序的运行结果为【】。 include void main(void) {int i=10;switch(i){case 9:i=i

    下列程序的运行结果为【 】。

    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;

    }


    正确答案:13
    13

  • 第2题:

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

    A.Char

    B.Byte

    C.Float

    D.Double

    E.Object


    参考答案:A, B

  • 第3题:

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

    A.byte

    B.long

    C.char

    D.float

    E.Short

    F.Long


    参考答案:A, C

  • 第4题:

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

  • 第5题:

    运行下面程序时,从键盘输入字母H,则输出结果是includemain(){ char ch;ch=getchar();s

    运行下面程序时,从键盘输入字母H,则输出结果是 #include<stdio.h> main() { char ch; ch=getchar(); switch(ch) { case 'H':printf("Hello!\n"); case 'G':printf("Good morning!\n"); default:printf("Bye_Bye!\n"); } }

    A.Hello!

    B.Hello! GoodMoring!

    C.Hello! Goodmorning! Bye_Bye!

    D.Hello! Bye_Bye!


    正确答案:C
    解析:本题主要对switch语句进行了考查。switch语句的执行过程为:进入switch结构后,对条件表达式进行运算,然后从上至下去找与条件表达式值相匹配的case,以此作为入口,执行switch结构中后面的各语句,直到遇到break语句,则跳出switch语句,如果各case都不匹配时则执行default后面的语句。本题中ch为字符'H',所以case'H'条件中的语句将被执行,由于没有break语句,所以case'C'后的语句也被执行,由于同样的缺少break语句,所以default后的语句也被执行了。

  • 第6题:

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

  • 第7题:

    You need to set the default gateway of one of your TestKing switches. Which command will set the default gateway to 192.168.12.1 on a Cisco switch?()

    A. Switch(config)# ip default-network 192.168.12.1

    B. Switch(config)#ip route-default 192.168.12.1

    C. Switch(config)# ip default-gateway 192.168.12.1

    D. Swicth(config)# ip route 192.168.12.1 0.0.0.0


    参考答案:C

  • 第8题:

    You need to set the default gateway of one of your TestKing switches. Which command will set the default gateway to 192.168.12.1 on a Cisco switch?()

    • A、Switch(config)# ip default-network 192.168.12.1
    • B、Switch(config)#ip route-default 192.168.12.1
    • C、Switch(config)# ip default-gateway 192.168.12.1
    • D、Swicth(config)# ip route 192.168.12.1 0.0.0.0

    正确答案:C

  • 第9题:

    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

  • 第10题:

    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

  • 第11题:

    单选题
    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
    解析: 暂无解析

  • 第12题:

    多选题
    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
    解析: 暂无解析

  • 第13题:

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

    A.Byte

    B.Long

    C.Float

    D.Double

    E.Object

    F.AandB

    G.CandD


    参考答案:A

  • 第14题:

    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

  • 第15题:

    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

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

    下列程序的输出结果是【】。 include void main() { inta(5),b(6),i(0)1j(0); switch(a

    下列程序的输出结果是【 】。

    include<iostream.h>

    void main()

    {

    inta(5),b(6),i(0)1j(0);

    switch(a)

    {

    case 5:switch(b)

    {

    case 5:i++;break;

    case 6:j++;break;

    defaun:i++;j++;

    }

    case 6:i++;

    j++;

    break;

    default:i++;j++;

    }

    cout<<i<<","<<j<<endl;

    }


    正确答案:12
    1,2

  • 第18题:

    以下程序的输出结果是( )。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。

  • 第19题:

    #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

  • 第20题:

    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

  • 第21题:

    switch语句中有无default都行,一般都有,default作用是跳出switch。


    正确答案:错误

  • 第22题:

    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

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


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

  • 第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
    解析: 暂无解析