福建省开课平台1398c++语言程序设计形考1-3参考答案

  [复制链接]
查看: 1404|回复: 6

23万

主题

23万

帖子

32万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
329160
发表于 2020-7-5 03:08:12 | 显示全部楼层 |阅读模式
福建省开课平台1398c  语言程序设计形考1-3参考答案.doc(121.05 KB, 下载次数: 0, 售价:   金币)<div class="tip tip_4" id="attach_ 12_menu" style="position: absolute; display: none" disautofocus="true"><div class="tip_c xs0">2020-3-24 15:43 上传
点击文件名下载附件

本课程目顺序随机,请使用Ctrl+F搜索

1.在下面的二维数组定义中,只有(    )语句是正确的。
       A.      int a[5][];         B.      int a[](10);         C.      int a[][];         D.      int a[][5]={{1,2,3},{4,5}};      
【答案】:D

2.假定AB为一个类,px为指向该类动态对象数组的指针,该数组长度为n,则执行“delete px;”语句时,自动调用该类析构函数的次数为(    )。
       A.      1         B.      n         C.      n-1         D.      n+1      
【答案】:B

3.当需要使用ifstream流类定义一个流对象并联系一个磁盘文件时,应在文件开始使用#include命令,使之包含(    )头文件。
       A.      strstrea.h         B.      stdlib.h         C.      iostream.h          D.      fstream.h      
【答案】:D

4.在下面的一维数组定义中,(    )语句有语法错误。
       A.      int a[]={1,2,3};         B.      int a[10]={0};         C.      int a[];         D.      int a[5];      
【答案】:C

5.假定a为一个数组名,则下面的(    )表达式有语法错误。
       A.      a<i>         B.      *++a         C.      *a         D.      *(a+1)      
【答案】:

.在下面的函数声明中,存在着语法错误的是(    )。
       A.      BC(int a, int)          B.      BC(int, int)         C.      BC(int, int=5)         D.        BC(int x= , int y)      
【答案】:

1.假定有结构定义为“struct BOOK{char title40; double price;};”,则该结构类型的长度为(    )个字节。
       A.      28         B.      40         C.      44         D.      48      
【答案】:

8.

当一个字符指针指向具有n个字节的存储空间时,它所能存储字符串的最大长度为(    )。
       A.      n         B.      n+1         C.      n-1         D.      n-2      
【答案】:

9.下面(    )的函数声明格式不正确。
       A.      AA(int a, int b);         B.      AA(int a=0, int b);         C.      AA(int a=0, int b=0);         D.      AA(int a, int b=0);      
【答案】:

10.下面的保留字(    )不能作为函数的返回类型。
       A.      void         B.      int         C.      new         D.      long      
【答案】:

11.设x是一个bool型的逻辑量,y的值为10,则表达式 x && y的值为(    )。
       A.      1         B.      0         C.      x的值         D.      x的相反值      
【答案】:

12.在下列的标识符常量的定义语句中,错误的定义语句是(    )。
       A.      const double PI=3.14159;         B.        const int N=20;          C.      const char ch;          D.        const bool mark=true;      
【答案】:

13.下面的函数声明中,(    )是“void BC(int a, int b);”的重载函数。
       A.      int BC(int x, int y);         B.      void BC(int a, char b);         C.      float AA(int a, char b);         D.      int BC(int a, int b=0);      
【答案】:

14.假定指针变量p定义为“int *p=new int30;”,要释放p所指向的动态数组空间,则使用下面的(    )语句。
       A.      delete p;         B.      delete *p;         C.      delete &p;         D.      delete []p;      
【答案】:

15.for循环语句一定能够被改写为(    )语句。
       A.      复合         B.      if         C.      switch         D.      while      
【答案】:

1 .设x和y均为bool量,则逻辑表达式x || y为假的条件是(    )。
       A.      x和y均为真         B.      其中一个为真         C.      x和y均为假         D.      其中一个为假      
【答案】:

11.假定AB为一个类,则该类的拷贝构造函数的声明语句为(    )。
       A.      AB&(AB x);         B.      AB(AB x);         C.      AB(AB* x);          D.      AB(AB&);      
【答案】:

18.下面的(    )保留字不能作为函数的返回类型。
       A.      void         B.      int         C.      new         D.      long      
【答案】:

19.break语句叫做(    )语句。
       A.      中断退出循环或开关         B.      返回         C.      转向         D.      继续      
【答案】:

20.程序运行中需要从键盘上输入多于一个数据时,各数据之间需要使用(    )符号作为分隔符。
       A.      空格或逗号         B.      逗号或回车         C.      逗号或分号         D.      空格或回车      
【答案】:

21.由C++源程序文件编译而成的目标文件的缺省扩展名为(    )。
       A.      obj          B.      lik         C.      exe         D.      cpp      
【答案】:

22.C++编译预处理命令在程序中都是以(    )字符开头的。
       A.      *         B.      #         C.      &         D.      @      
【答案】:

23.声明或定义一个内联函数时,必须在函数开始使用保留字(    )。
       A.      static         B.      const         C.      extern         D.      inline      
【答案】:

24.将两个字符串连接起来组成一个字符串时,选用(    )函数。
       A.      strlen()         B.      strcpy()         C.      strcat()         D.      strcmp()      
【答案】:

25.枚举类型中的每个枚举常量的值都是一个(    )值。
       A.      整数         B.      浮点数         C.      字符         D.      逻辑      
【答案】:

2 .

假定要对结构类型AB定义加号运算符重载的普通函数,实现两个AB类型对象的加法,并返回相加结果,则该函数的声明语句为(    )。
       A.       AB operator +(AB& a, AB& b);         B.        AB operator +(AB& a);          C.      operator +(AB a);          D.      AB& operator +();      
【答案】:

21.假定a为一个整型数组名,则元素a4与(    )的表示等价。
       A.      a+4         B.      *a+4         C.      *(a+4)         D.      *(a+1 )      
【答案】:

28.

C++源程序文件的默认扩展名为(    )。
       A.      cpp         B.      exe         C.      obj          D.      lik      
【答案】:

29.

循环语句“for(int i=0; i<n; i++);”执行结束后得到的i的值为(    )。
       A.      n         B.      n+1         C.      n-1         D.      2n      
【答案】:

30.任何for语句都能够被改写为(    )语句。
       A.      复合         B.      if         C.      switch         D.      while      
【答案】:

31.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int n=5, sum=0;



           while(n) {



               sum+=n;



               n--;



           }



           cout<<”sum=”<<sum<<endl;



       }
【答案】:

32.

写出下列每个程序运行后的输出结果



    #include<iostream.h>



       #include<stdlib.h>



       void main() {



           int x=20, y= , z;



           char op=’+’;



           switch(op) {



               case '+': z=x+y; break;



               case '-': z=x-y; break;



               default: {cout<<& uot;操作符op出错,退出运行!& uot;;exit(1);}



           }



           cout<<”z=”<<z<<endl;



       }










【答案】:

33.

写出下列每个程序运行后的输出结果



     #include<iostream.h>



       int WF(int x, int y) {



           x=x+y;



           y=x+y;



           return x+y;



       }









       void main() {



           cout<<WF(8,5)<<endl;



       }
【答案】:

34.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int n=5, sum=0;



           while(n) {



               sum+=n*n;



               n--;



           }



           cout<<& uot;sum=& uot;<<sum<<endl;



       }
【答案】:

35.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       int* LG(int m) {



           int* a=new int(m+5);



           return a;



       }



       void main() {



           int n1=12;



           int *b=LG(n1);



           cout<<*b<<endl;



           delete b;



       }
【答案】:

3 .

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       int LA(int a, int n) {



           int s=0;



           for(int i=0;i<n;i++)



               s+=ai;



           return s;



       }



       void main() {



           int a5={5,2,8, ,4};



           int b=LA(a,5);



           cout<<& uot;b=& uot;<<b<<endl;



       }
【答案】:

31.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       int a=10, b=15, c;



       void main() {



           c=a+b;



           { int b=a+20;



             c+=a+b;



           }



           cout<<c<<endl;



       }
【答案】:

38.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       const int N= ;



       void main() {



           int aN={1 ,83,54, 2,40, 5};



           int c1, c2;



           c1=c2=a0;



           for(int i=1;i<N;i++)



               if(ai>c1) c1=ai;



               else if(ai<c2) c2=ai;



           cout<<c1<<' '<<c2<<endl;



       }
【答案】:

39.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       #include<string.h>



       struct Worker {



           char name15; int age; float pay;



       };



       void main() {



           Worker x;



           strcpy(x.name, & uot;WeiRong& uot;);



           x.age=45; x.pay=3215;



           cout<<x.name<<' '<<x.age<<' '<<x.pay<<endl;



       }
【答案】:

40.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a ={ ,9,12,18,15,20};



           int c=0;



           for(int i=0; i< ; i++)



               if(ai%2==1) c++;



           cout<<& uot;c=& uot;<<c<<endl;



       }
【答案】:

41.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       void main() {



           int a5={3, ,9,12,8};



           for(int *p=a; p<a+5; p++)



               if(*p>8) cout<<*p<<' ';



       }
【答案】:

42.

写出下列每个程序运行后的输出结果



    #include<iomanip.h>



       const int N=9;



       void main() {



           int aN={2,4, ,8,10,12,14,1 ,18};



           int s=0;



           for(int i=0; i<N; i++) {



               if(ai%3==0) s+=ai;



           }



           cout<<”s=”<<s<<endl;



       }
【答案】:

43.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int i=1,s=0;



           while(s<15) s+=i++;



           cout<<i<<','<<s<<endl;



       }
【答案】:

44.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       class A {



           int a,b;



       public:



           A() {a=b=0;}



           A(int aa, int bb) {



               a=aa; b=bb;



               cout<<a<<' '<<b<<endl;



           }



       };



       void main() { A x,y(3,4);}
【答案】:

45.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       int LB(int *a, int n) {



           int p=1;



           for(int i=0;i<n;i++) {



               p*=*a; a++;



           }



           return p;



       }



       void main() {



           int a5={1,2,3,4,3};



           cout<<LB(a,5)<<endl;



       }
【答案】:

4 .

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a34={{1,2,1,8},{5, ,11,15},{9,20,3,4}};



           int m=a00;



           for(int i=0;i<3;i++)



               for(int j=0;j<4;j++)



                   if(aij>m) m=aij;



           cout<<m<<endl;



       }
【答案】:

41.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void SB(char ch) {



           switch(ch) {



             case 'A': case 'a': cout<<& uot;优!& uot;<<’ ’; break;



             case 'B': case 'b': cout<<& uot;良!& uot;<<’ ’; break;



             case 'C': case 'c': cout<<& uot;通过!& uot;<<’ ’; break;



             default: cout<<& uot;不通过!& uot;;break;



           }



       }









       void main() {



           SB(’A’); SB(’c’);



           cout<<endl;



       }
【答案】:

48.

写出下列每个程序运行后的输出结果



       #include<iostream.h>



       #include<string.h>



       void main() {



           char* a5={& uot;student& uot;,& uot;worker& uot;,& uot;cadre& uot;,& uot;soldier& uot;,& uot;apen& uot;};



           unsigned int n=strlen(a0);      //求字符串a0的长度



           for(int i=1;i<5;i++) {



               if(strlen(ai)>n) n=strlen(ai);



           }



           cout<<n<<endl;



       }
【答案】:

49.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       void main() {



           int a8={4,8,15,1 ,20,30,48, 2};



           int *p=a,s=0;



           while(p<a+8) {



               s+=*p;



               p+=3;



           }



           cout<<s<<endl;



       }
【答案】:

50.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void FF(int a, int n) {



           int i,x;



           for(i=0; i<n/2; i++) {



               x=ai; ai=an-1-i; an-1-i=x;



           }



       }



       void main() {



           int a8={ ,19,4,12,20,5,18,25};



           FF(a,8);



           cout<<a0<<','<<a1<<endl;



       }
【答案】:

51.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       void main() {



           int a8={4,8,15,1 ,20,30,48, 2};



           int *p=a;



           while(p<a+8) {



               cout<<*p<<' ';



               p+=3;



           }



           cout<<endl;



       }
【答案】:

52.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       const int N= ;



       void main() {



           int aN={1 ,83,54, 2,40, 5};



           int c1=0;



           for(int i=0;i<N;i++)



               if(ai>= 0) c1++;



           cout<<& uot;c1=& uot;<<c1<<endl;



       }
【答案】:

53.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int s1=0;



           for(int i=1; i<=5; i++) s1+=2*i;



           cout<<”s1=”<<s1<<endl;



       }
【答案】:

54.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int s=0;



           for(int i=1;i<=8;i+=2)



               s+=i*i;



           cout<<& uot;s=& uot;<<s<<endl;



       }
【答案】:

55.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a8={3 ,25,48,14,55,20,41,82};



           int c1=0, c2=0;



           for(int i=0; i<8; i++)



               if(ai<50) c1++; else c2++;



           cout<<c1<<' '<<c2<<endl;



       }
【答案】:

5 .

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int n=4,y=1;



           while(n--) y*=3;



           cout<<& uot;y=& uot;<<y<<endl;



       }
【答案】:

51.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a ={3 ,25,48,14,55,40};



           int x=a0;



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



               if(ai>x) x=ai;



           cout<<”x=”<<x<<endl;



       }
【答案】:

58.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       void main()



       {



           int a ={32,53,21,19,12,45};



           for(int *p=a; p<a+ ; p++)



               if(*p%3==0) cout<<*p<<’ ’;



           cout<<endl;



       }
【答案】:

59.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       int LF(int x, int y) {



           x=x+y; y=x+y;



           return x+y;



       }



       void main() {



           int x=5, y=8;



           cout<<LF(1,2)<<' '<<LF(3,4)<<endl;



       }
【答案】:

0.

写出下列每个程序运行后的输出结果



  #include<iomanip.h>



       void main() {



           int* d=new int5;



           int i,s=0;



           for(i=0;i<5;i++) di=2*i+1;



           for(i=0;i<5;i++) s+=di;



           cout<<3*s<<endl;



           deleted;



       }
【答案】:

1.

写出下列每个程序运行后的输出结果



#include<iomanip.h>



       struct AB {



           char aa15;



           int bb;



       };



       void main() {



           AB a4={{& uot;Apple& uot;,25},{& uot;Peach& uot;,40},{& uot;Pear& uot;,3 },{& uot;Tomato& uot;, 2}};



           for(int i=0;i<4;i++)



               if(ai.bb<40) cout<<ai.aa<<' ';



           cout<<endl;



       }
【答案】:

2.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a8={2,8,10,5,12,1,9,20};



           int c=0, i=0;



           while(i<8) {



               if(ai>10) c++;



               i++;



           }



           cout<<& uot;c=& uot;<<c<<endl;



       }
【答案】:

3.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a8={ ,19,4,12,20,5,18,25};



           int *p, s=0;



           for(p=a; p<a+8;p++)



               if(*p<10) s+=*p;



           cout<<s<<endl;



       }
【答案】:

4.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       void main() {



           int a=10, b=15, c;



           c=a+b;



           { int b=a+20;



             c+=a+b;



           }



           cout<<c<<endl;



       }
【答案】:

5.

写出下列每个程序运行后的输出结果



#include<iostream.h>



       struct Worker {



           char name15;  //姓名



           int age;        //年龄



           float pay;      //工资



       };



       void main() {



           Worker x={& uot;wangfong& uot;,4 ,1 40};



           Worker y, *p;



           y=x; p=&x;



           cout<<y.age+10<<' '<<p->pay*2<<endl;



       }
【答案】:

  .

int SA(int a, int b) {



           if(a>b) return 1;



           else if(a==b) return 0;



           else return -1;



       }







    函数功能:
【答案】:

1.

bool WB(int a, int n, int x) {



          for(int i=0;i<n;i++)



              if(ai==x) return true;



          return false;



       }







    函数功能:
【答案】:

8.

bool SG(int x) {        //x为大于等于2的整数



           int a=int(s rt(x));  //s rt(x)为求x的平方根



           int i=2;



           while(i<=a) {



               if(x%i==0) break;



               i++;



           }



           if(i<=a) return true; else return false;



       }







    函数功能:
【答案】:

9.

double WA(double a, int n) {



           double s=0;



           for(int i=0;i<n;i++) s+=ai;



           return s/n;



       }







    函数功能:
【答案】:

10.

double FI(int n) {     //n为大于等于1的整数



           double x,y=0;



           do {



               cin>>x;



               y+=x;



           } while(--n);



           return y;



       }







    函数功能:
【答案】:

11.

int LK(int a, int n) {



           double s=0;



           int i,m=0;



           for(i=0;i<n;i++) s+=ai;



           s=s/n;



           for(i=0;i<n;i++) if(ai>=s) m++;



           return m;



       }







    函数功能:
【答案】:

12.

int LK(int a, int n) {



           float s=0; int i;



           for(i=0;i<n;i++) s+=ai;



           s/=n;



           int m=0;



           for(i=0;i<n;i++) if(ai>=s) m++;



           return m;



       }







    函数功能:
【答案】:

13.

int LJ(int a, int n) {



           int k=0;



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



               if(ai>ak) k=i;



           return ak;



       }







    函数功能:
【答案】:

14.

int WC(int a, int n, int k) {



           int c=0;



           for(int i=0;i<n;i++)



               if(ai>=k) c++;



           return c;



       }







    函数功能:
【答案】:

15.





double FI(double n) {    //n为大于等于1的整数



           double x,y=0;



           for(int i=0; i<n; n++) {



               cin>>x; y+=x;



           }



           return y;



       }







    函数功能:
【答案】:

1 .

假定结构类型DNode中的data域为结点值域,next域为结点指针域。



       void QB(DNode *f)    //f指向单链表的表头结点



       {



           if(f==NULL) return;



           while(f!=NULL) {



               cout<<f->data<<' ';



               f=f->next;



           }



       }







    函数功能:
【答案】:

11.

假定结构类型Worker中的name域表示姓名,age域表示年龄,pay域表示工资。



       void QA(Worker a, int n) {



           for(int i=0; i<n; i++)



               cin>>ai.name>>ai.age>>ai.pay;



       }







    函数功能:
【答案】:

18.

bool WE(int a, int b, int n) {



           for(int i=0;i<n;i++)



               if(ai!=bi) break;



           if(i==n) return true; return false;



       }







    函数功能:
【答案】:

19.

int WG(int a, int b) {

           if(a>0 && b>0) return 1;



           else if(a<0 && b<0) return -1;



           else return 0;



       }







    函数功能:
【答案】:

80.

double FI(int n) {     //n为大于等于1的整数



           double x,y=0;



           do {



               cin>>x;



               y+=x*x;



           } while(--n);



           return y;



       }







    函数功能:
【答案】:

81.

int SC(int a, int b, int c) {



           if(a>b) a=b;



           if(a>c) a=c;



           return a;



       }







    函数功能:
【答案】:

82.

假定结构类型StrNode带有一个字符串域name20和一个结点指针域next。



       int QB(StrNode* f) {      //f为单链表的表头指针



           if(f==NULL) return 0



           int n=0;



           while(f!=NULL) {n++; f=f->next;}



           return n;



       }







    函数功能:
【答案】:

83.

int WD(int a, int n) {



           int m=a0;



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



               if(ai>m) m=ai;



           return m;



       }







    函数功能:
【答案】:

84.

int LK(int a, int n) {



           double s=0;



           int i,m=0;



           for(i=0;i<n;i++) s+=ai;



           s=s/n;



           for(i=0;i<n;i++) if(ai>=s) m++;



           return m;



       }







    函数功能:
【答案】:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x





上一篇:福建省开课平台1391中学语文教学研究形考1-3参考答案
下一篇:福建省开课平台1801中国法律思想史形考1-3参考答案
回复

使用道具 举报

0

主题

3444

帖子

5166

积分

论坛元老

Rank: 8Rank: 8

积分
5166
发表于 2022-3-13 02:02:35 | 显示全部楼层
奥鹏南开大学作业可以做吗?
回复

使用道具 举报

0

主题

3628

帖子

5447

积分

论坛元老

Rank: 8Rank: 8

积分
5447
发表于 2022-3-13 11:58:06 | 显示全部楼层
贵州电大形考作业可以做吗?
回复

使用道具 举报

0

主题

3562

帖子

5343

积分

论坛元老

Rank: 8Rank: 8

积分
5343
发表于 2022-3-14 05:07:29 | 显示全部楼层
奥鹏福建师范大学电大形考作业可以做吗?
回复

使用道具 举报

0

主题

3641

帖子

5462

积分

论坛元老

Rank: 8Rank: 8

积分
5462
发表于 2022-3-15 22:43:08 | 显示全部楼层
奥鹏大连理工大学形考作业可以做吗?
回复

使用道具 举报

0

主题

3541

帖子

5312

积分

论坛元老

Rank: 8Rank: 8

积分
5312
发表于 2022-3-16 07:09:04 | 显示全部楼层
福建电大形考作业有答案吗?
回复

使用道具 举报

0

主题

3405

帖子

5108

积分

论坛元老

Rank: 8Rank: 8

积分
5108
发表于 2022-3-16 08:31:08 | 显示全部楼层
计算机和英语的统考资料有吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

精彩课程推荐
|网站地图|网站地图