• python作业2


    一. 单选题

    1. (单选题)下列数据类型中,Python不支持的是_______。
      A. int
      B. float
      C. char
      D. list

    2. (单选题)Python语句"f1=lambda x:x*2; f2=lambda x:x**2; print(f1(f2(2)))"的程序运行结果是________
      A. 2
      B. 4
      C. 6
      D. 8

    3. (单选题)Python中,若def f1(p,**p2):print(type(p2)),则f1(1,a=2)的程序运行结果是_______。
      A. <class ‘int’>
      B. <class ‘type’>
      C. <class ‘dict’>
      D. <class ‘list’>

    4. (单选题)下列哪些是可变对象?
      A. int
      B. str
      C. list
      D. float

    5. (单选题)下列选项中,与s[0:-1]表示的含义相同的是______。
      A. s[-1]
      B. s[:]
      C. s[:len(s)-1]
      D. s[0:len(s)]]

    6. (单选题)Python程序中对于表达式123+‘XYZ’,解释器将抛出______错误信息。
      A. NameError
      B. FileNotFoundError
      C. SyntaxError
      D. TypeError

    7. (单选题)以下关于字符串的描述错误的是()
      A. 字符串s的首字符是s[0]
      B. 在字符串中,同一个字母的大小是等价的
      C. 字符串中的字符都是以某种二进制编码的方式进行存储和处理的
      D. 字符串也能进行关系比较操作

    8. (单选题)以下关于异常处理try语句块的说法,不正确的是_______。
      A. finally语句中的代码始终要保证被执行
      B. 一个try块后接一个或多个except块
      C. 一个try块后接一个或多个finally块
      D. try块必须与except或finally块一起使用

    9. (单选题)下列选项中,对于函数定义错误的是_______。
      A. def myfunc(a,b)
      B. def myfunc(a,*b)
      C. def myfunc(*a,b)
      D. def myfunc(a,b=2)

    10. (单选题)
      下列表达式中,能用于判断字符串s1是否属于字符串s(即s1是否s的子串)的是( )。
      ①s1 in s;②s.index(s1)>0; ③s.find(s1)>0;④s.rfind(s1)>0;⑤s.rindex(s1)>0
      A. ①②
      B. ①②③
      C. ①②③④
      D. ①②③④⑤
      二. 填空题

    11. (填空题)Python表达式10+5//3-True+False的值为___ 10 _____。

    12. (填空题)表达式 chr(ord(‘a’)-32) 的值为____A_______。

    13. (填空题)数学表达式在这里插入图片描述
      的Python表达式为:__math.sin(15math.pi/180)+(math.pow(math.e,x)-5x)/math.sqrt(xx+1)-math.log(3x);____。

    math.sin(15math.pi/180)+(math.pow(math.e,x)-5x)/math.sqrt(xx+1)-math.log(3x);
    from math import *
    sin(pi/12) + (ex -5x) / sqrt(xx + 1) - log(3x);
    math.sin(15
    math.pi/180)+(math.exp(x)-5*×)/math.sqrt(x
    2+1)-math.log(3x);
    from math import *
    sin(radians(15))+(pow(e,x)-5
    x)/(sqrt(x2+1))-log(3*x,e);
    math.sin(math.pi/12)+((math.e
    x-5x)/math.sqrt(x**2+1))- math.log(math.e,3x);
    math.sin(15math.pi/180)+(math.exp(x)-5x)/math.sqrt(x2+1)-math.log(3x);
    math.sin(15/180
    math.pi)+(math.exp(x)-5*x)/math.sqrt(x
    2+1)-math.log(math.e,3x);
    math.sin(math.pi
    15/180) + ((math.exp(x) - 5x)/math.sqrt(x**2 + 1)) - math.log(3x);
    math.sin(math.pi15/180) + (math.exp(x) - 5x)/math.sqrt(x**2 + 1) - math.log(3x);
    sin(15
    math.pi/180)+(math.pow(math.e,x)-5x)/math.sqrt(xx+1)-math.log(3*x);

    1. (填空题)在直角坐标系中,x,y是坐标系中任意点的位置,用x和y表示第一象限或第二象限的Python表达式为____x>0______。

    x>0 and y>0 or x<0 and y>0;
    x>0 and y>0 or x<0 and y>0;
    (x>0 and y>0) or (x<0 and y>0);
    x!=0 and y>0;
    x!=0 and y>0;
    y>0 and x!=0;
    (x<0 and y>0) or (x>0 and y>0)

    1. (填空题)已知 x = [5, 6, 7],那么执行语句 x[:3] = [8]之后,x的值为______ [8] _____ ;此时再执行语句 x[3:] = [9]之后,x的值为___ [8,9] ___。

    2. (填空题)在python中,使用内置函数___ locals() ___ 和____globals()___,可以查看并输出局部变量和全局变量列表。

    3. (填空题)已知 arr = [[3,4], [8,9]],则表达式 [col for row in arr for col in row] 的值为___[3, 4, 8, 9]____。

    4. (填空题)表达式 {1, 2, 3} & {2, 3, 4} 的值为____{2,3} ____ ;表达式 {1, 2, 3} - {3, 4, 5} 的值为__ {1,2} ____。

  • 相关阅读:
    HTML静态网页作业html+css+javascript+jquery水果商城7页
    TCP的三次握手和四次挥手
    点餐系统数据库设计--SQL Server
    实测 ubuntu 20.04 使用 lidar_imu_calib 功能包 进行 激光雷达与imu标定
    FreeMarker
    信息学奥赛一本通:1310:【例2.2】车厢重组
    秋招每日一题T23——连通图
    【LeetCode力扣】LCR170 使用归并排序的思想解决逆序对问题(详细图解)
    12.进程同步与信号量
    题目:2703.返回传递的参数数量
  • 原文地址:https://blog.csdn.net/m0_56600567/article/details/125451236