以下文字与答案无关
提示:有些试题内容 显示不完整,文字错误 或者 答案显示错误等问题,这是由于我们在扫描录入过程中 机器识别错误导致,人工逐条矫正总有遗漏,所以恳请 广大网友理解。
#include <stdio.h>
main( )
{ int i, a20], s, count;
s=count=0;
for(i=0;__ ; i++)
scanf(“%d”, &ai] );
for(i=0; i<20; i++)
{ if( ai]<0 ) continue ;
___ ;
count++;
}
printf(“s=%d\t count=%d\n”, s, count”);
}
}
sum(int k)
{
int x=0;
return (x+=k);
}
程序运行后的输出结果是 ( )。
选项: A:55
B:45
C:15
D:10
">2.有以下程序#include <stdio.h>
void main()
{
int s,i,sum();
for (i=1;i<=10;i++)
s=sum(i);
printf("s=%d\n",s);
}
sum(int k)
{
int x=0;
return (x+=k);
}
程序运行后的输出结果是 ( )。
选项: A:55
B:45
C:15
D:10
}
sum(int k)
{
int x=0;
return (x+=k);
}
程序运行后的输出结果是 ( )。
选项: A:55 B:45 C:15 D:10">3.有以下程序#include <stdio.h>
void main()
{
int s,i,sum();
for (i=1;i<=10;i++)
s=sum(i);
printf("s=%d\n",s);
}
sum(int k)
{
int x=0;
return (x+=k);
}
程序运行后的输出结果是 ( )。
选项: A:55 B:45 C:15 D:10sort(a,5);
printf("Now,the sequence is:\n");
for(i=0;i<n;i++)
printf("%d ",ai]);
}
void sort(int a],int n)
{ int i, j;
int temp;
for( i = 1; i < n; i++ )
for (j = 0; j < n-i; j++ )
if (*(a+j) > *(a+j+1))
{ temp=*(a+j) ;
*(a+j)=*(a+j+1);
*(a+j+1)=temp;
}
}
#include<stdio.h>
void sort(int a],int n);
int main(){
int a5];
int i;
for(i=0;i<5;i++)
scanf("%d",&ai]);
sort(a,5);
printf("Now,the sequence is:\n");
for(i=0;i<n;i++)
printf("%d ",ai]);
}
void sort(int a],int n)
{ int i, j;
int temp;
for( i = 1; i < n; i++ )
for (j = 0; j < n-i; j++ )
if (*(a+j) > *(a+j+1))
{ temp=*(a+j) ;
*(a+j)=*(a+j+1);
*(a+j+1)=temp;
}
}
#include “stdio.h”
main( )
{
int i=0;
while(i<10)
{
if(i<1)continue;
if(i= =5)break;
i++;
}
}
选项: A:1
B:10
C:6
D:死循环,不能确定次数
for(i=0;i<10;i++)
/************found************/
if(___(1)___)
{ f=1;
/************found************/
___(2)___;
}
if(f)
printf("%d is No. %d\n", n,k);
else
printf(" %d not found !\n",n);
}
">6.2.查找n在数组a中最后一次出现的位置(数组首元素的位置为零)。例如:如果a数组中的元素为:1,5,2,5,6,8,7,4,3,0,
当n=5时,程序的输出结果为:5 is No.3 。
当n=10时,程序的输出结果应为:10 not found !。
#include <stdio.h>
void main( )
{ int a10]={1,5,2,5,6,8,7,4,3,0};
int i,k,n,f=0;
scanf("%d",&n);
for(i=0;i<10;i++)
/************found************/
if(___(1)___)
{ f=1;
/************found************/
___(2)___;
}
if(f)
printf("%d is No. %d\n", n,k);
else
printf(" %d not found !\n",n);
}
5050
B:4950
C:450
D:45
for(i=0;i<10;i++)
/************found************/
if(___(1)___)
{ f=1;
/************found************/
___(2)___;
}
if(f)
printf("%d is No. %d\n", n,k);
else
printf(" %d not found !\n",n);
}
">10.2.查找n在数组a中最后一次出现的位置(数组首元素的位置为零)。
例如:如果a数组中的元素为:1,5,2,5,6,8,7,4,3,0,
当n=5时,程序的输出结果为:5 is No.3 。
当n=10时,程序的输出结果应为:10 not found !。
#include <stdio.h>
void main( )
{ int a10]={1,5,2,5,6,8,7,4,3,0};
int i,k,n,f=0;
scanf("%d",&n);
for(i=0;i<10;i++)
/************found************/
if(___(1)___)
{ f=1;
/************found************/
___(2)___;
}
if(f)
printf("%d is No. %d\n", n,k);
else
printf(" %d not found !\n",n);
}
SUM
B:AVG
C:COUNT
D:MAX
A、++count
B、$count++;
C、count++;
D、$count =+1
}
选项: A:123
B:2412
C:246
D:248
">14.执行下列程序段后,屏幕输出结果是______。int i,s=2;
for(i=1;i<=3;i++)
{ s=s*i;
printf("%d",s);
}
选项: A:123
B:2412
C:246
D:248
/**********found**********/
if (find==__3__) printf("\nDon't found!\n");
}
main()
{ char xN]M]={"BASIC","C langwage","Java","QBASIC","Access"},strM];
int i;
printf("\nThe original string\n\n");
for(i=0;i<N;i++)puts(xi]); printf("\n");
printf("\nEnter a string for search : "); gets(str);
fun(x,str);
}
">15.第22套程序填空题
所属年份:2010.9;2011.3;
下列给定程序中,函数fun的功能是:在形参ss所指字符串数组中,查找含有形参substr所指子串的所有字符串,并输出,若没找到则输出相应信息。ss所指字符串数组中共有N个字符串,且串长小于M。程序中库函数strstr(s1,s2)的功能是在s1串中查找s2子串,若没有,函数值为0,若有,函数值为非0。
请在下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。
注意:部分源程序在文件BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
#include <stdio.h>
#include <string.h>
#define N 5
#define M 15
void fun(char (*ss)M], char *substr)
{ int i,find=0;
/**********found**********/
for(i=0; i< __1__ ; i++)
/**********found**********/
if( strstr(ssi], __2__) != NULL )
{ find=1; puts(ssi]); printf("\n"); }
/**********found**********/
if (find==__3__) printf("\nDon't found!\n");
}
main()
{ char xN]M]={"BASIC","C langwage","Java","QBASIC","Access"},strM];
int i;
printf("\nThe original string\n\n");
for(i=0;i<N;i++)puts(xi]); printf("\n");
printf("\nEnter a string for search : "); gets(str);
fun(x,str);
}
/**********found**********/
if (find==__3__) printf("\nDon't found!\n");
}
main()
{ char xN]M]={"BASIC","C langwage","Java","QBASIC","Access"},strM];
int i;
printf("\nThe original string\n\n");
for(i=0;i<N;i++)puts(xi]); printf("\n");
printf("\nEnter a string for search : "); gets(str);
fun(x,str);
}
">16.第22套程序填空题
所属年份:2010.9;2011.3;
下列给定程序中,函数fun的功能是:在形参ss所指字符串数组中,查找含有形参substr所指子串的所有字符串,并输出,若没找到则输出相应信息。ss所指字符串数组中共有N个字符串,且串长小于M。程序中库函数strstr(s1,s2)的功能是在s1串中查找s2子串,若没有,函数值为0,若有,函数值为非0。
请在下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。
注意:部分源程序在文件BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
#include <stdio.h>
#include <string.h>
#define N 5
#define M 15
void fun(char (*ss)M], char *substr)
{ int i,find=0;
/**********found**********/
for(i=0; i< __1__ ; i++)
/**********found**********/
if( strstr(ssi], __2__) != NULL )
{ find=1; puts(ssi]); printf("\n"); }
/**********found**********/
if (find==__3__) printf("\nDon't found!\n");
}
main()
{ char xN]M]={"BASIC","C langwage","Java","QBASIC","Access"},strM];
int i;
printf("\nThe original string\n\n");
for(i=0;i<N;i++)puts(xi]); printf("\n");
printf("\nEnter a string for search : "); gets(str);
fun(x,str);
}
}
选项: A:123
B:2412
C:246
D:248
">17.执行下列程序段后,屏幕输出结果是______。int i,s=2;
for(i=1;i<=3;i++)
{ s=s*i;
printf("%d",s);
}
选项: A:123
B:2412
C:246
D:248
ArrayList arrNumber = new ArrayList();
arrNumber.Capacity = 2;
for (int i = 0; i < 5; i++)
{
arrNumber.Add(i);
}
Console.WriteLine(arrNumber.Count);
选项: A:2 B:4 C:5 D:8import java.util.Scanner;
public class Main {
public static void main(String] args) {
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
char x]=(2分);
int a=0;
int b=0;
int c=0;
int d=0;
for(int i=0;(2分);i++){
char ch=xi];
if((2分))
a++;
else if((2分))
b++;
else if(ch==' ')
(2分);
else
d++;
}
System.out.println("letters="+a);//输出英文字母个数
System.out.println("digits="+b);//输出数字个数
System.out.println("spaces="+c);//输出空格个数
System.out.println("others="+d);//输出其他字符个数
}
}
for (int i=0;i<list.length;i++)
System.out.print(listi]+" ");
System.out.println();
}
public static void main(String] args){
int] list1={0,1,2,3};
int] list2=new intlist1.length];
list2=list1;
PrintLst("数组1",list1);
PrintLst("数组2",list2);
list12]=list12]+10;
PrintLst("修改数组1后,数组2为",list2);
}}
">21.阅读下列程序,并给出程序运行的结果。public class CopyArray{
public static void PrintLst(String s,int] list){
System.out.print(s+":");
for (int i=0;i<list.length;i++)
System.out.print(listi]+" ");
System.out.println();
}
public static void main(String] args){
int] list1={0,1,2,3};
int] list2=new intlist1.length];
list2=list1;
PrintLst("数组1",list1);
PrintLst("数组2",list2);
list12]=list12]+10;
PrintLst("修改数组1后,数组2为",list2);
}}
import re
sum = 0
pattern = 'back'
if re.match(pattern, 'backup.txt'):
sum += 1
if re.match(pattern, 'text.back'):
sum += 2
if re.search(pattern, 'backup.txt'):
sum += 4
if re.search(pattern, 'text.back'):
sum += 8
print(sum)
选项: A:12
B:13
C:8
D:3