举一反三
- 阅读下面一段示例程序: demo_list = [] demo_list.append("A","B") print(demo_list) 运行程序,其最终执行的结果为
- 当输入为 ‘cbabc’ 时,下列程序的输出结果为?s1 = raw_input() index = 0 s2 = '' while index [ len(s1) - 1: if s1[index] ] s1[index + 1]: s2 += s1[index] else: s2 = s2 * 2 index += 1 print s2
- 写出下面程序的输出结果 publicclassTestjava{ publicstaticvoidmain(String[]args){ Stringstr="abbaefabbewbvwabbswgfga"; System.out.println("count="+getSubCount(str,"abb")); } publicstaticintgetSubCount(Stringstr,Stringkey){ intcount=0; intindex=0; while((index=str.indexOf(key,index))!=-1){ System.out.println("index="+index); index=index+key.length(); count++; } returncount; } }
- 阅读下面的程序,其时间复杂度为_________?1. int index =...009. index=index+2;
- score是一个整数数组,有五个元素,已经正确初始化并赋值,仔细阅读下面代码,程序运行结果是() temp = score[0]; for (int index = 1;index < 5;index++) { if (score[index] < temp) { temp = score[index]; } }
内容
- 0
以下程序段的结果是( )。String str="abcdefghijk";String s="bcde";int index=0;index=str.indexOf(s,index);str=str.substring(0,index)+str.substring(index+4);System.out.println(str); A: abcdefghijk B: afghijk C: abcde D: bcdefghijk
- 1
请阅读下面一段程序: list_one = ["One", "Two"] list_two = ["Three", "Four"] list_one.extend(list_two) print(list_one) 运行程序,其最终执行的结果为
- 2
下面程序段的运行结果为() int index=1; int[] foo=new int[3]; int bar=foo[index]; int baz= bar+index;
- 3
#include<stdio.h> main() {int i,index,n: int a[10]; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); index=0; for(i=1;i<n;i++) {if(a[i]<a[index])index=i;} printf("min=%d,index=%d\n",a[index],index); } 程序运行时输入5 7 9 5<回车>,则程序运行结果是:______[/i][/i]
- 4
下面代码运行结果是什么?()words=[“hello”]words.append(“world”)print(word[1])