niusouti.com

执行以下代码后的输出结果是哪一个选项? my_list = [s.lower() for s in 'Life is short, you need Python.'.split(' ')] print('short' in my_list) print(my_list[5])A.True python.B.False python.C.True PythonD.False Python

题目

执行以下代码后的输出结果是哪一个选项? my_list = [s.lower() for s in 'Life is short, you need Python.'.split(' ')] print('short' in my_list) print(my_list[5])

A.True python.

B.False python.

C.True Python

D.False Python


相似考题
参考答案和解析
**0****2**
更多“执行以下代码后的输出结果是哪一个选项? my_list = [s.lower() for s in 'Life is short, you need Python.'.split(' ')] print('short' in my_list) print(my_list[5])”相关问题
  • 第1题:

    (7)执行下列语句后,输出结果是。 s$="ABCDEFG" Print InStr(s$,"efg") Print LCase$(s$)


    正确答案:0abcdefg
    【解析】本题考查了字符串函数的应用。InStr函数是字符串匹配函数,它的格式为:InStr([首字符位置,]字符串1,字符串2[,n])。它的功能是在字符串1中查找字符串2,如果找到了,则返回字符串2的第一个字符在字符串1中的位置。注意:字符串的第一个字符的位置为1。
      LCase$函数是字母大小写转换函数,它的格式为:LCase$(字符串)。它可以将字符串中的大写字母转换为小写字母。
    UCase$函数也是字母大小写转换函数,它的格式为:UCase$(字符串)。它可以将字符串中的小写字母转换为大写字母。

  • 第2题:

    以下语句的输出结果【 】。

    S$= "China"

    S$= "Shanghai"。

    Print S$


    正确答案:Shanghai
    Shanghai 解析:s$的最终值是Shanghai,所以输出的应该是Shanghai。

  • 第3题:

    下列语句执行后的输出结果是______。 Wage=26 Print"工资"; Print Wage

    A.工资□26

    B.工资□□26

    C.工资□26

    D.工资□□26


    正确答案:A

  • 第4题:

    执行下面程序后输出的正确结果是( )。 public class Test{ public static void main(String args[]){ System.out.print(100%3); System.out.print(","); System.out.print(100%0); } }

    A.1,1

    B.1,1.0

    C.1.0, l

    D.1.0,1.0


    正确答案:B

  • 第5题:

    假设X的值是5,则执行以下语句时,可得到的输出结果是ABCDEF的Select Case语句是 ( )

    A.Select Case X Case 10 To 1 Print“ABCDEF” End Select

    B.Select Case X Case Is>15,Is<5 Print"ABCDEF" End Select

    C.Selecl Case K Case Is>5,1,3,To 10 Print"ABCDEF" End Select

    D.Select Case X Case 1,3,Is>5 Print"ABCDEF" End Select


    正确答案:C
    解析:本题主要是对多分支结构 Select Case语句的考查。
      其中在Case子句中,表达式列表可以是多个表达式,每个表达式之间用逗号分割,表达式可以是如下形式x
      值、值1 To值2(注意:值1值2)、Is比较运算符值。执行时,首先计算Select Case语句中测试表达式的值。然后从每一个Case开始找满足该值的Case语句,遇到第一个表达式列表值与测试表达式相匹配的Case语句,则执行其后的语句序列,然后跳出Select Case结构。题中选项B、D中的表达式列表中都不包含有X的值,故可直接排除。选项A中的 Case子句后的表达式如果写成1 To 10,则可输出结果“ABCDEF”。选项D中,X的值在表达式3 To 10的范围内,故可以执行其后的语句序列,输出"ABCDEF'。

  • 第6题:

    以下程序的输出结果是______。 include define FUDGE(y)2.84+y define PR(a)printf("

    以下程序的输出结果是______。 #include<stdio.h> #define FUDGE(y) 2.84+y #define PR(a) printf("%d",(int)(a)) #define PRINT() PR(s) ;putchar('\n') main() { intx=2; PRINT1 (FUDGE(5)*x); }

    A.11

    B.12

    C.13

    D.15


    正确答案:B
    解析:在程序中如果有带实参的宏,则按#define命令行中指定的字符串从左到右进行置换,如果串中包含宏中的形参,则将程序语句中相应的实参代替形参。将实参带入已经定义的宏中,可以得出答案为“12”。

  • 第7题:

    执行下列语句后,输出结果是______。

    s$="ABCDEFG"

    Print lnStr(s$,"efg")

    Print LCase$(s$)


    正确答案:0CR>abcdefg
    0CR>abcdefg 解析: 本题考查了字符串函数的应用。lnStr函数是字符串匹配函数,它的格式为:InStr([首字符位置,]字符串1,字符串2[,n])。它的功能是在字符串1中查找字符串2,如果找到了,则返回字符串2的第一个字符在字符串1中的位置。注意:字符串的第一个字符的位置为1。

  • 第8题:

    若有以下程序段: int r=8; print("%d\n",r>>1): 输出结果是( )。 A.16B.8S

    若有以下程序段: int r=8; print("%d\n",r>>1): 输出结果是( )。

    A.16

    B.8

    C.4

    D.2


    正确答案:C
    本题考查移位运算。将8转为二进制数为1000,右移一位不足补0,结果为0100,转化为十进制结果为4。

  • 第9题:

    执行以下语句后,输出的结果是 a$="Good" b$="Afternoon" Print a$+b$ Print a$&b $

    A.Goodaftenoon GoodAfternoon

    B.Good+ GoodAfternoon

    C.Good+ Good&Afternoon

    D.Good Good&


    正确答案:A
    解析:字符串的运算符有“&”,表示将两个字符串连接在一起,“+”也可以起到相同的作用,但为了使程序严谨并提高可读性,一般不使用“+”。

  • 第10题:

    给定以下JAVA代码,这段代码编译运行后输出的结果是( )

    publicclassTest{

    publicstaticintaMethod(inti)throwsException{

    try{

    returni/10;

    }catch(Exceptionex){

    thrownewException("exceptioninaaMothod");

    }finally{

    System.out.print("finally");

    }

    }

    publicstaticvoidmain(String[]args){

    try{

    aMethod(0);

    }catch(Exceptionex){

    System.out.print("exceptioninmain");

    }

    System.out.print("finished");

    }

    }

    A、finallyexceptioninmainfinished

    B、exceptioninmainfinally

    C、finallyfinished

    D、finallyexceptioninmainfinished


    正确答案:C

  • 第11题:

    以下代码中变量result的可能类型有哪些?byte b = 11;short s = 13;result = b * ++s;

    A.byte, short, int, long, float, double

    B.boolean, byte, short, char, int, long, float, double

    C.byte, short, char, int, long, float, double

    D.byte, short, char

    E.int, long, float, double


    正确答案:E
     

  • 第12题:

    单选题
    You are the administrator of the company network. The network consists of a single active directory domain. The network includes 10 servers running Windows Server 2003 and 200 client computers running Windows XP Professional. You install and configure a server named TestKingSrv as a print server. The name of the print queue is //TestKingSrv/laserprinter. You assign the Everyone group the Allow - Print permissions. A user named Lisa in the Finance department reports that she is unable to print to //TestKingSrv/laserprinter. Several other users report that they are unable to print to //TestKingSrv/laserprinter. You log on to Lisa's computer and submit several print jobs, but none of them print and no error message is displayed. In Printers and Faxes on Lisa's computer, you open //TestKingSrv/laserprinter. You see the following status of the print queue: "laserprinter on TestKingSrv is unable to connect". You are able to ping TestKingSrv. You need to ensure that print jobs submitted to //TestKingSrv/laserprinter will be printed. What should you do?()
    A

    On a domain controller, create a shared printer object in Active Directory for //TestKingSrv /laserprinter.

    B

    From a command prompt on Lisa's computer, run the Net Print //TestKingSrv /lasterprinter command.

    C

    On Lisa's computer, open the Services console and restart the Print Spooler service.

    D

    On Lisa's computer, open the Services console and connect to TestKingSrv. Restart the Print Spooler service.


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

  • 第13题:

    哪个选项是下面代码的执行结果()s='PYTHON'print("{0:3}".format(s))

    A、PYTHON

    B、PYT

    C、PYTH

    D、PYTHON


    答案:A

  • 第14题:

    若有以下变量定义和函数调用语句: int a=25; print_value(&a); 则执行下面函数后正确的输出结果是( )。 void print_value(int*x) { cout<<++*x<<endl; }

    A.23

    B.24

    C.25

    D.26


    正确答案:D

  • 第15题:

    以下程序的执行结果是______ include include void print(int n) { if(n

    以下程序的执行结果是______

    include<iostream.h>

    include<iomanip.h>

    void print(int n)

    {

    if(n!=0)

    {

    print(n-1);

    for(int i=1;i<=n;i++=

    cout<<setw(3)<<i;

    cout<<endl;

    }

    }

    void main()

    {

    print (4);

    }


    正确答案:1 1 2 1 2 3 1 2 3 4
    1 1 2 1 2 3 1 2 3 4

  • 第16题:

    编译和执行以下代码,输出结果是( )。 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


    正确答案:C

  • 第17题:

    执行语句Print”25+32=”,25+32的输出结果是 【 】。


    正确答案:25+32=57
    25+32=57 解析:本题主要是对Print方法的考查。题中"25+32="是一个字符串,故原样输出。后边是一表达式,故应输出其结果值。最后的输出结果为:25+32=57。

  • 第18题:

    执行以下语句后,输出的结果是 s$=“ABCDEFGHI” Print Mid$(s$,3,4) Print Len(s$)

    A.ABCD 11

    B.CDEF 11

    C.EFGH 11

    D.HIJK 11


    正确答案:B
    解析:Mid(s$,i,n)表示从字符串s$的第i个字符开始向后截取n个字符,Len(s$)返回字符串s$的长度。

  • 第19题:

    以下程序运行后,输出结果是______。includess(char*s){char *p=s; while(*.p)p++; retu

    以下程序运行后,输出结果是______。#include<stdio.h>ss (char *s){ char *p=s; while(*.p)p++; return(p-s);}main(){ char *a="abded"; int i; i=ss((A); print ("%d\n",i);}

    A.8

    B.7

    C.6

    D.5


    正确答案:D

  • 第20题:

    ●某处理器按照大端方式工作,以下C语言代码执行后的输出是(63) 。

    char iArr[10]={0,1,2,3,4,5,6,7,8,9};

    short tVal; short *pVal= NULL;

    pVal= (short *)(iArr+2);

    tVal= *pVal;

    printf(“tVal= %#x\n”,tVal);

    (63)

    A.tVal=0x203

    B.tVal=0x302

    C.tVal=515

    D.tVal= 770


    正确答案:A

  • 第21题:

    以下语句的输出结果是 a=Sqr(3) Print Format(a, "$$ # # # # . # # #")

    A.$1.732

    B.$S1.732

    C.1732

    D.$$0001.732


    正确答案:B
    解析:本题主要是对输出格式的考查。Format的一般格式为:Format(数字表达式,格式字符串)格式字符串中描述符有好多,其中“#”指输出数字,不在输出的前后补0;“$”表示在输出数字前加“$”。题中“$$####. ###”表示在输出数据前加“$$”且输出数据保留三位小数。故选项B正确。

  • 第22题:

    执行下列语句后,输出结果为______。

    s$="ABCDEFG"

    Print InStr(s$,"efg")

    Print LCase$(s$)


    正确答案:0CR>abcdefg
    0CR>abcdefg 解析:本题考查了字符串函数的应用。InStr函数是字符串匹配函数,它的格式为:InStr([首字符位置,]字符串1,字符串2[,n])。它的功能是在字符串1中查找字符串2,如果找到了,则返回字符串2的第一个字符在字符串1中的位置。注意:字符串的第一个字符的位置为1。
    LCase$函数是字母大小写转换函数,它的格式为:LCase$(字符串)。它可以将字符串中的大写字母转换为小写字母。
    UCase$函数也是字母大小写转换函数,它的格式为:UCase$(字符串)。它可以将字符串中的小写字母转换为大写字母。

  • 第23题:

    单选题
    有以下程序:#include #define F(x) 2.84+x#define PR(a) printf(%d,(int)(a))#define PRINT(a) PR(a);putchar('')main(){ PRINT(F(5)*2);}程序运行后的输出结果是(  )。
    A

    12

    B

    13

    C

    15

    D

    11


    正确答案: A
    解析:
    直接置换宏定义命令行中相应形参字符串,非形参字符保持不变。将PRINT(F(5)*2)用PR(F(5)*2); putchar('')替换,将PR(F(5)*2)用printf(“%d”, (int)(F(5)*2))替换,再将F(5)用2.84+5替换,最后替换结果为printf(“%d”, (int)(2.84+5*2)); putchar(''),运行结果为:12<回车>。答案选择A选项。

  • 第24题:

    单选题
    s=’ilovepython’print(s[1:5])输出结果是()
    A

    ilove

    B

    love

    C

    python

    D

    lovep


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