题库 第6187页
单选题:哪个选项能够最简单的在列表['apple','pear','peach','orange']中随机选取一个元素?
哪个选项能够最简单的在列表['apple','pear','peach','orange']中随机选取一个元素?@[B](2)A. shuffle()B. choice()C. sample()D. random()A.shuffle()B…
单选题:下面代码的输出次数是?
下面代码的输出次数是?```k=1000while k˃1: print(k) k=k/2```@[C](2)A. 1000B. 9C. 10D. 11A.1000B.9C.10D.11答案:C…
单选题:若想获得当前年份并输出,以下错误的是:
若想获得当前年份并输出,以下错误的是:@[D](2)A. ```import datetimeprint(datetime.datetime.now().year)```B. ```from datetime import datetime…
单选题:以下代码的输出结果是:
以下代码的输出结果是:```def fun(n): if n==1 or n==2: res = 1 else: res = fun(n-1)+fun(n-2) return resprint(fun(5))```@[C](2)A. 2…
单选题:以下代码的输出是:
以下代码的输出是:```def fun(a, *b): n = 0 for i in b: n += i return n res = fun(1, 3, 5, 7)print(res)```@[A](2)A. 15B. 16C…
单选题:下面的方法,当输入为2的时候返回值是多少?( )
下面的方法,当输入为2的时候返回值是多少?( )public int getValue(int i) { int result = 0; switch (i) { case 1:…
单选题:一个对象是( )的实例。
一个对象是( )的实例。@[B](2)A. 程序B. 类C. 方法D. 数据A.程序B.类C.方法D.数据答案:B…
单选题:现有声明Circle x = new Circle(),如下哪句是最确切的。( )
现有声明Circle x = new Circle(),如下哪句是最确切的。( )@[C](2)A. x包含了一个int型数据。B. x包含了一个Circle类型的对象。C. x包含了一个Circle对象的引用。D. x可将一个int…
单选题:T(n)表示当输入规模为n时的算法效率,以下算法效率最优的是()。
T(n)表示当输入规模为n时的算法效率,以下算法效率最优的是()。@[C](2)A. T(n)=T(n-1)+1,T(1)=1B. T(n)=2n$$^{2}$$C. T(n)=T(n/2)+1,T(1)=1D. T(n)=3nlog$$_…
单选题:In the following fragment, which line should be corrected.
In the following fragment, which line should be corrected.```1. if ( age ˃= 65 );2. printf( "Age is greater than or equa…