以下程序调用scanf函数给变量a输入数值的方法是错误的,其错误原因是( )。 #include <stdio.h> main() { int *p,*q,a,b; p=&a; printf("input a:"); scanf("%d",*p); }
A.*p表示的是指针变量p的地址
B.*p表示的是变量a的值,而不是变量a的地址
C.*p表示的是指针变量p的值
D.*p只能用来说明p是一个指针变量
第1题:
以下四个程序中,完全正确的是( )。
A.#include<stdio.h>
B.#include<stdio.h> main(); main() {/*programming*/ {/*/programming/*/ printf("programming!\n");} printf("programming!\n");}
C.#include<stdio.h>
D.include<stdio.h> main() main() {/*/*programming*/*/ {/*programming*/ printf("programming!\n");} printf("programming!\n");}
第2题:
以下程序试图把从终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符#时结束输入和输出操作,但程序有错。 #include<stdio.h> main() { FILE *fout; char ch; fout=fopen('abc.txt','W'); ch=fgetc(stdin); while (ch!='#') { fputc (ch,fout); ch=fgetc(stdin); } fclose (fout); } 出错的原因是( )。
A.函数fopen调用形式错误
B.输入文件没有关闭
C.函数fgetc调用形式错误
D.文件指针stdin没有定义
第3题:
A.*p表示的是指针变量p的地址
B.*p表示的是变量a的值,而不是变量a的地址
C.*p表示的是指针变量p的值
D.*p只能用来说明p是一个指针变量
第4题:
以下程序中调用cin函数给变量a输人数值的方法是错误的,其错误原因是 #include<iostream.h> void main() { int*p,*q,a,b; p=&a; cout<<”input a:”; cin>>p; }
A.*p表示的是指针变量p的地址
B.p表示的是变量a的地址,而不是变量a的值
C.*p表示的是指针变量p的值
D.*p只能用来说明p是一个指针变量
第5题:
以下四个程序中,完全正确的是( )。
A.#include <stdio.h> main( ); { /* programmlng* / printf( "programming! \n" ); }
B.#include <stdio.h> main( ) { /*/programming printf("programming! \n"); }
C.#include <stdio.h> main( ) { /*programming* / printf( "programming! \n" ); }
D.include <stdio.h> main ( ) { /*/* programming*/*/ printf( "programming! \n" ); }
第6题:
有以下程序 #include <stdio.h> main() { int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:");printf("%d\n",p); } 该程序试图通过指针p为变量n读入数据并输出,但程序有多处错误,以下语句正确的是
A.int n,*p=NULL;
B.*p=&n;
C.scanf("%d",&p)
D.printf("%d\n",p);
第7题:
以下程序中调用scanf函数给变量a输入数值的方法是错误的,其错误原因是
main()
{ int *p,*q,a,b;
p=&a;
printf("input a:");
scanf("%d",*p); }
A.*p表示的是指针变量p的地址
B.*p表示的是变量a的值,而不是变量a的地址
C.*p表示的是指针变量p的值
D.*p只能用来说明p是一个指针变量
第8题:
执行程序时的输入为123456789,则程序的运行结果为 【7】 。
#include "stdio.h"
main()
{ int a,b;
scanf( "%2d%*2d%1d",&a,&b);
printf( "%d\n",a-b);}
第9题:
以下程序试图把从终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符串#号时结束输入和输出操作,但程序有错 #include<stdio.h> main() { FILE*fout; char ch; fout=fopen('abc.txt','w'); ch=fgetc(stdin); while(ch!='#') { fputc(ch,four); ch=fgetc(stdin); } fclose(fout); } 出错的原因是______。
A.函数fopen调用形式错误
B.输入文件没有关闭
C.函数fgetc调用形式错误
D.文件指针stdin没有定义
第10题:
执行程序时的输入为123456789,则程序的运行结果为( )。 include"stdio.h" main() { int a,b; scanf("%2d%*2d%1d",&a,&B); printf("%d\n",a-B); }