国产18禁黄网站免费观看,99爱在线精品免费观看,粉嫩metart人体欣赏,99久久99精品久久久久久,6080亚洲人久久精品

2016全國計算機等級考試三級數(shù)據(jù)庫技術(shù)上機指導(dǎo):考試內(nèi)容

時間:2016-10-31 15:29:00   來源:233網(wǎng)校     [字體: ]

上機考試內(nèi)容

  1 程序編制調(diào)試運行

  當試題抽取成功后,上機考試系統(tǒng)已將需編制程序的部分源程序存放到文件PROG1.C中,考生在指定的三級信息管理技術(shù)C語言環(huán)境中,按照試題給定的要求在PROG1.C文件中進行程序的編寫,經(jīng)過調(diào)試和運行,最后得到其運行結(jié)果并存放到指定的輸出結(jié)果文件中。一般來說輸出結(jié)果文件格式在程序中已給出,考生不必自行編寫,只要調(diào)用即可。

  程序編制題只有一種題型:編寫部分程序或函數(shù)。那么怎樣編制程序呢?首先在編制程序之前,考生必須要理解試題,并分析出試題要求做什么,得出的結(jié)果怎樣輸出,再編寫部分程序并調(diào)試運行,直至程序運行得到正確結(jié)果為止。

  1.評分規(guī)則

  程序編制、調(diào)試運行這一類試題的評分規(guī)則是判定最終的運行結(jié)果,按正確結(jié)果的多少,按比例進行給分?忌帉懙某绦蚍椒ê蛢(nèi)容可以有所不同,但必須得出正確的結(jié)果,才能得分。

  2.舉例

  例1:函數(shù)ReadDat()實現(xiàn)從文件IN.DAT中讀取一篇英文文章, 存入到字符串數(shù)組xx中; 請編制函數(shù)encryptChar(), 按給定的替代關(guān)系對數(shù)組xx中的所有字符進行替代, 仍存入數(shù)組xx的對應(yīng)的位置上, 最后調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT.DAT中。

  替代關(guān)系:f(p)=p*11 mod 256 (p是數(shù)組xx中某一個字符的ASCII值, f(p)是計算后新字符的ASCII值),如果計算后f(p)值小于等于32或大于130,則該字符不變, 否則將f(p)所對應(yīng)的字符進行替代。

  注意:部分源程序存放在PROG1.C中, 原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符。

  請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。部分源程序如下:

  #include 

  #include 

  #include 

  #include 

  unsigned char xx[50][80];

  int maxline=0 ; /* 文章的總行數(shù) */

  int ReadDat(void) ;

  void WriteDat(void) ;

  void encryptChar()

  {

  }

  void main()

  {

  clrscr() ;

  if(ReadDat()) {

  printf(“數(shù)據(jù)文件ENG.IN不能打開!\n\007”) ;

  return ; }

  encryptChar() ;

  WriteDat() ;

  }

  int ReadDat(void)

  {

  FILE *fp ;

  int i=0 ;

  unsigned char *p ;

  if((fp=fopen(“n.dat”, r))==NULL) return 1 ;

  while(fgets(xx[i], 80, fp)!=NULL) {

  p=strchr(xx[i], ′\n′) ;

  if(p) *p=0 ;

  i++ ;

  }

  maxline=i ;

  fclose(fp) ;

  return 0 ;

  }

  void WriteDat(void)

  {

  FILE *fp ;

  int i ;

  fp=fopen(“out.dat“, w) ;

  for(i=0 ; i < maxline ; i+[ +) {

  printf(“%s\n“, xx[i]) ;

  fprintf(fp, “%s\n“, xx[i]) ;

  }

  fclose(fp) ;

  }

  分析:根據(jù)題意分析得出:本題主要考查考生的字符串指針或字符串數(shù)組以及根據(jù)公式進字符的ASCII值運算,再根據(jù)運算結(jié)果和條件進行相應(yīng)的替代操作,要求考生僅編寫函數(shù)encryptChar()實現(xiàn)轉(zhuǎn)換功能。其中輸入及輸出函數(shù)給出且已調(diào)用,考生不必自己編寫。

  編寫函數(shù)encryptChar()的程序內(nèi)容如下:

  void encryptChar()

  { int i, j, val ;

  for(i=0 ; i

  for(j=0 ; j

  val=(xx[i][j]*11) % 256 ;

  if(! (val<=32 || val>130)) xx[i][j]=val ;

  }

  }

  數(shù)據(jù)文件IN.DAT內(nèi)容如下:

  You may WANT A FIELD in field in each record to uniquely identify that1234

  record from all other records IN THE FILE. For example, the Employee123456

  Number field is unique if you DO NOT ASSIGN the same number to two12345678

  different employees, and you never reassign THESE NUMBERS to other12345678

  employees. If you wish to FIND OR MODIFY the record belonging to a11111111

  specific employee, this unique FIELD SAVES the thouble of determining22222

  whether you have the correct record.12345678901234567

  If you do not have a unique field, YOU MUST FIND THE first record123456787

  the matches your key and determine whether THEN RECORD is the one you33333

  want. If it is not the CORRECT ONE, you must search again to find others.4

  結(jié)果文件OUT.DAT內(nèi)容如下:

  Youm+3WAZTAF#EDDinbiWlLinW+AxrWAorLtouniquWl3iLWntib3tx+t1&1<rWAorLbrom+llotxWrrWAorLs#ZTHEF#DE.ForW(+mplW,txWEmplo3WW1&1

 

  例2: 文件in.dat中有200個正整數(shù),且每個數(shù)均在1000至9999之間。函數(shù)readDat()是讀取這200個數(shù)存放到數(shù)組aa中。請編制函數(shù)jsSort(),其函數(shù)的功能是:要求按每個數(shù)的后三位的大小進行升序排列,將排序后的前10個數(shù)存入數(shù)組b中,如果數(shù)組b中出現(xiàn)后三位相等的數(shù)值,則對這些數(shù)值按原始4位數(shù)據(jù)進行降序排列。最后調(diào)用函數(shù)writeDat()把結(jié)果bb輸出到文件out.dat中。

  例:處理前 6012 5099 9012 7025 8088

  處理后 9012 6012 7025 8088 5099

  注意:部分源程序存在文件PROG1.C文件中。

  請勿改動數(shù)據(jù)文件in.dat中的任何數(shù)據(jù)、主函數(shù)main()、讀函數(shù)readDat()和寫函數(shù)writeDat()的內(nèi)容。

  部分源程序如下:

  #include

  #include

  #include

  int aa[200], bb[10] ;

  void jsSort()

  {

  }

  void main()

  {

  readDat() ;

  jsSort() ;

  writeDat() ;

  }

  readDat()

  {

  FILE *in ;

  int i ;

  in=fopen(“in.dat“, r) ;

  for(i=0 ; i<200 ; i+[KG-*3]+) fscanf(in, “%d,“, &aa[i]) ;

  fclose(in) ;

  }

  writeDat()

  {

  FILE *out ;

  int i ;

  clrscr() ;

  out=fopen(“out.dat“, w) ;

  for(i=0 ; i<10 ; i+[KG-*3]+) {

  printf(“i=%d,%d\n“, i + 1,bb[i]) ;

  fprintf(out, “%d\n“, bb[i]) ;

  }

  fclose(out) ;

  }

 

  分析:根據(jù)題意分析得出:本題主要考查考生的運用數(shù)組和排序的能力,要求考生僅編寫函數(shù)jsSort實現(xiàn)此功能。其中輸出函數(shù)給出且已調(diào)用,考生不必自己編寫。

  編寫函數(shù)jsSort的程序如下:

  void jsSort()

  {

  int i, j, m ;

  for(i=0 ; i<199 ; i++)

  for(j=i + 1 ; j<200 ; j++) {

  if((aa[i] % 1000)>(aa[j] % 1000)) {

  m=aa[i] ;

  aa[i]=aa[j] ;

  aa[j]=m ;

  }

  else if((aa[i] % 1000)= =(aa[j] % 1000)) {

  if(aa[i]

  m=aa[i] ;

  aa[i]=aa[j] ;

  aa[j]=m ;

  }

  }

  }

  for(i=0 ; i<10 ; i++) bb[i]=aa[i] ;

  }

  數(shù)據(jù)文件IN.DAT內(nèi)容如下:

  1862,8281,6183,5180,1217

  8215,8865,7110,1870,4373

  7447,8420,8252,8809,7968

  7331,3472,4126,8101,5576

  7397,2066,5940,9779,7947

  2912,1226,2238,4122,6210

  2020,3721,1646,8324,2351

  2345,1862,5186,7573,8949

  3211,2103,6695,7968,6157

  9956,2998,4063,6096,9432

  6452,2422,1382,5813,8138

  7486,1178,7650,1687,5012

  4845,1428,3197,6077,4650

  6641,2695,5758,8855,5321

  1337,5323,9154,6419,8044

  3654,2246,1890,3250,5542

  1976,5986,5051,8053,7377

  3726,6189,9483,5874,9246

  2522,1020,3492,4032,4367

  9784,4746,3130,8521,7837

  6521,7917,6240,1225,4092

  8022,6893,2075,8043,7409

  3316,5688,4600,6016,2953

  6206,4100,8947,6264,1986

  4933,6105,7054,9121,5318

  3164,9609,5784,4178,4906

  3731,2996,4218,3498,3849

  3835,5491,3890,3531,1475

  8219,3720,8585,9616,6539

  4961,8850,5822,2769,1269

  2171,2104,3681,9291,5768

  3582,3035,7212,8313,5669

  4782,7545,7917,8561,5447

  4912,7624,1343,8579,5639

  5745,1833,7948,4321,3090

  9389,2796,8073,7806,4910

  7970,2808,8109,8664,5963

  3660,1396,1380,5705,7269

  7417,5590,2823,6308,1754

  5467,8126,9822,6737,1023

  結(jié)果文件OUT.DAT的內(nèi)容如下:

  5012

  6016

  2020

  1020

  8022

  1023

  4032

  3035

  8043

  8044