下面的程序执行后,文件test中的内容是。voidfun(char*fname,char*st){FILE*myf;inti;myf=fopen(fname,w);for(i=0;st[i];i++)fputc(st[i],myf);fputc(&39;\0&39;,myf);fclose(myf);}main{fun(test,newworld);fun(test,hello,);}()
A.hello,
B.new worldhello,
C.new world
D.hello, rld
时间:2024-05-18 16:28:51
相似题目
-
有两个文件test1和test2,test2有内容,现在执行cattest1>>test2,则test2文件内容全部删除。()
A . 正确
B . 错误
-
阅读以下说明和Java代码,将应填入____处的语句或语句成分写在答题纸的对应栏内。
【说明】某数据文件students.txt的内容为100名学生的学号和成绩,下面的程序将文件中的数据全部读入对象数组,按分数从高到低进行排序后选出排名前30%的学生。【Java代码】
https://assets.asklib.com/psource/2016072810392893550.gif
-
下面的命令执行后都将生成ABCDBF表文件,其中一定生成空表文件的命令是()。
A . SORTTOABC
B . COPYTOABC
C . COPYSTRUCTURETOABC
D . COPYFILETOABC
-
执行下面的指令后,AL中的数据是()。MOVAL,0A5HANDAL,3FH
A . 25H
B . 0BFH
C . 3FH
D . 0AFH
-
以下程序运行后,文件test.txt的内容是( )。#includevoid main(){ FILE*fp;charstr[][10]={first,second};fp = fopen(test.txt,w);if(fp!=NULL)fprintf(fp,%s,str[0]);fclose(fp);fp = fopen(test.txt,w);if(fp!=NULL)fprintf(fp,%s,str[1]);fclose(fp);}
-
某人编写编写了下面的程序,希望能把Text1文本框中的内容写到out.txt文件中:PrivateSubCommand1_Click()Openout.txtForOutputAs#2PrintText1Close#2EndSub调试时发现没有达到目的,为实现上述目的,应做的的修改是()
-
源程序test.c经编译产生的目标文件和连接后产生的可执行文件是( )
-
源程序test.c经编译产生的目标文件和连接后产生的可执行文件是( )
-
执行下面的_______操作后,文件的读写指针不指向文件首。
-
设有下面的循环: i=1 Do i=i+3 Debug.print(i) Loop Until i>_________ 程序运行后要执行 3 次循环体,则条件中的最小值为( )。
-
设有下面的循环:i=1Doi=i+3Debug.print(i)Loop Until i>_________程序运行后要执行3次循环体,则条件中的最小值为( )。
-
执行下列程序,文件中保存的内容为
file=open('test.txt', 'wt+')
file.write('hello SCUT')
file.close()
file=open('test.txt', 'at+')
file.write('hello world')
file.close()
A、hello
B、hello
C、hello
D、hello
-
对于下面的文件内容和程序,正确的结论是()。//以下是文件mydoc.txt的内容intss=100//以下是C程序内容includevoidmain(){include"mydoc.txt"printf("s=%d/n",s)}
A.程序有错,文件包含语句写在主函数体内
B.程序没有错误,输出是:s=100
C.程序没有语法错误,但没有输出数据
D.程序有错,两个文件包含预处理语句使用了不同的括号括住文件名
-
请阅读下面的程序 public class Test { public static void main(String[] args) { int m = 37;
请阅读下面的程序 public class Test { public static void main(String[] args) { int m = 37; int n = 13; while (m != n) { while (m > n) { m -= n; } while (m < n) { n -= m; } } System.out.println("m=" + m); } } 下列选项中,哪一个是正确的运行结果()
A、m=37
B、m=13
C、m=1
D、m=2
-
使用VC6打开老考生文件夹下的工程test5_1,此工程包含一个源程序文件test5_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:
x=3 y=5 z=0
8
源程序文件test5_1.cpp清单如下:
include<iostream.h>
static int x=5;
int z=0;
int *add(int x,int y)
{
cout<<"X="<<X<<"y="<<y<<" Z="<<z<<endl;
z=z+x+y;
/********found*********/
return z;
/********found*********/
};
void main()
{
int y=5;
int x=3;
/*********found********/
cout<<&(add(X,y))<<endl;
}
-
使用VC6打开考生文件夹下的工程test19_1,此工程包含一个源程序文件test19_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:
1:
weight:5
age:0
2:
weight:7
age:9
源程序文件test19_1.cpp 清单如下:
include <iostream.h>
class animal
{
public:
/**************** found *******************/
friend void setvalue(animal&,int);
/**************** found *******************/
void print()
protected:
int itsweight;
int itsage;
};
void animal::print()
{
cout<<"weight:"<<itsweight<<end1;
cout<<"age:"<<itsage<<end1;
}
void setvalue(animal &ta,int tw)
{
ta.itsweight=tw;
ta.ihsage=0;
}
void setvalue(animal &ta,int tw, int tn)
{
ta.itsweight=tw;
ta.itsage=tn;
}
void main()
{
/**************** found *******************/
animal peppy
setvalue(peppy,5);
cout<<"1:"<<end1;
peppy.print();
setvalue(peppy,7,9);
cout<<"2:"<<end1;
peppy.print();
}
-
使用VC6打开考生文件夹下的工程test23_1,此工程包含一个源程序文件test23_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:
i
iz
O
12
22
源程序文件test23_1.cpp清单如下:
include<iostream.h>
include<stdio.h>
class innerclass
{
int x;
public:
/****************found*******************/
innerclass(int z) { x=z; cout<<"iz"<<endl;};
/****************found*******************/
void write() {print("%d\n",x);}
}
class outerclass
{
int y;
innerclass g;
innerclass *h;
public:
outerclass(int a);
void write() { printf("%d\n",y); }
void write_inner_g() {g.write(); }
void write_inner_h() {h->write();}
};
outerclass::outerclass(int a)
{
/****************found*******************/
h=new innerclass(12);
cout<<"o"<<endl;
}
int main ()
{
outerclass ob(22);
ob.write_inner_h();
ob.write();
return 1;
}
-
使用VC6打开考生文件夹下的工程test4_1,此工程包含一个源程序文件test4_1.cpp,但该程序在类的定义中存在问题,请改正类定义中的错误,使程序的输出结果如下:
a=3 b=13
a=5 b=13
注意:请勿修改主函数main中的任何内容。
源程序文件rcst4_1.cpp清单如下:
include<iostream.h>
class T
{
public:
/*********found***+******/
T(int x){a=x; b+=x;)
/+********found**********/
void display(T c)
{ cout<<"a="<<c.a<<"\t"<<"b="<<c.b<<endl;)
private:
const int a;
static int b;
};
/**********found*********/
int b=5;
void main()
{
T A(3),B(5);
T::display(A);
T::display(B);
}
-
执行下面的程序后,AX寄存器中的数据是()。 BUT DW 10DUP(2) XOR AX, AX
执行下面的程序后,AX寄存器中的数据是()。 BUT DW 10DUP(2) XOR AX, AX MOV CX, LENGTH MOV SI,SIZE BUF—TYPEBUF NEXT: ADD AX,BUF [SI] SUB SI,TYPE BUF LOOP
A.20
B.30
C.32
D.40
-
对于下面的语句,执行的结果是()Response.Write(“中国” );Response.End();(意思使得 web服务器停止处理并返回结果, 文件中剩余的内容将不被处理 )Response.Write(“你好” );
A.中国你好
B.中国
C.你好
D.出错
-
关于下面的程序Test.java说法正确的是()。public class Test {String x="1";int y;
关于下面的程序Test.java说法正确的是()。
public class Test {
String x="1";
int y;
public static void main(String args[]) {
int z=2;
System.out.println(x+y+z);
}
}
A.3
B.102
C.12
D.程序有编译错误
-
Linux系统在默认情况下将创建的普通文件的权限设置为 (请作答此空) ,若要将/test文件的权限设置为所有用户都具有读写执行的权限,则正确的命令是()
A.-rw-r--r--
B. -r--r--r--
C. -rw-rw-rwx
D. -rwxrwxrw-
-
已有文本文件test.txt,其中的内容为:Hello, everyone!(,与everyone之间没有空格)。以下程序中,文件test.txt已正确为“读”而打开,由此文件指针fr指向文件,则程序的输出结果是______。 include <stdio.h> void main() FILE *fr; char str[40]; …… fgets(str,8,fr); printf("%s",
-
10、12. 假设一个目录中有5个文件:test.c test1.c test2.c test3.cpp test10.c,执行命令“ls test*.?”后显示的文件是()。
A.test.c test1.c test2.c test3.cpp
B.test1.c test2.c test10.c
C.test1.c test2.c test3.cpp
D.test.c test1.c test2.c test10.c