NOIP 2007 Preliminary Round universal answer papers +

(The answer at the end oh QWQ)

Examination paper

1. In the following part, the () is not a CPU 

Controller

calculator

Register

Motherboard
 

2. In a relational database, the database stored in the logical structure data in () based

Binary Tree

multi-branch tree

dimensional table

 

3. In the following, only () is not a common unit of computer storage capacity
TB

 

4. The meaning of the ASCII code ()

two decimal conversion code →

  American Standard Code for Information Interchange

  digital binary code

  The only character encoding computer can handle

 

5. A computer system should include complete ()

System hardware and system software

hardware and software systems

Host and external devices

Host, a keyboard, a display, and a secondary memory

 

6.IT meaning is ()

Communication Technology

Information Technology

Network Technology

Informatics

 

7. The the LAN is the meaning of ().

  Internet

LAN

WAN

MAN

 

8. The redundant data may be derived by means of other data. For example, the database has aged students three subjects of mathematics, language and English, if it is stored out of three subjects, the score can be seen as redundant data. Redundant data often leads to inconsistent data. For example, if all the above four data input, due to operational errors so that the total score is not equal to the sum of three subjects, is a contradiction. The following statement on redundant data, the right is ().

do compatibility testing is less efficient, can not ignore the redundant data in the database
 

9. In the following software, does not belong to NOIP contest (semi-finals) has recommended the use of language environment (). Editor's note: This is 2007

gcc

Free Pascal

 

10. The still store data after the power failure has ().

hard disk

RAM

 

11. In the following statements about computer language in, right there ().

C is an object-oriented high-level computer language

 

12.近20年来,许多计算机专家都大力推崇递归算法,认为它是解决较复杂问题的强有力的工具。在下列关于递归算法的说法中,正确的是(  )。

对于已经定义好的标准数学函数 sin(x),应用程序中的语句“y=sin(sin(x));”就是一种递归调用

 

 

13.一个无法靠自身的控制终止的循环成为“死循环”,例如,在C语言程序中,语句while(1) printf("*");就是一个死循环,运行时它将无休止地打印*号。下面关于死循环的说法中,只有(  )是正确的。

死循环与多进程中出现的“死锁”差不多,而死锁是可以检测的,因而,死循环也可以检测的

 

 

14.在C语言中,表达式23|2^5的值是()

32

 

15.在C语言中,判断a等于0或b等于0或c等于0的正确的条件表达式是(  )。

(a=0)&&(b=0)&&(c=0)

 

16.地面上有标号为A、B、C的三根柱,在A柱上放有10个直径相同中间有孔的圆盘,从上到下依次编号为1,2,3……,将A柱上的部分盘子经过B柱移入C柱,也可以在B柱上暂存。如果B柱上的操作记录为“进、进、出、进、进、出、出、进、进、出、进、出、出”。那么,在C柱上,从下到上的编号为(  )。

2 4 3 6 7 5

 

17..与十进制数1770对应的八进制数是(  )。

3540
 

18.设A=B=True,C=D=False,一下逻辑运算表达式值为假的有(  )。

(A∧(D∨C))∧B

 

19.(2070)16 +(34)8的结果是()。

 A.833210

B.208A16

C.1000000001102

D.(20212)8

 

20.已知7个节点的二叉树的先根遍历是1 2 4 5 6 3 7(数字为节点的编号,以下同),中根遍历是4 2 6 5 1 7 3,则该二叉树的后根遍历是(  )。

4 6 5 3 1 7 2

 

 

 

21.(子集划分)将n个数(1,2,…,n)划分成r个子集。每个数都恰好属于一个子集,任何两个不同的子集没有共同的数,也没有空集。将不同划分方法的总数记为S(n,r)。例如,S(4,2)=7,这7种不同的划分方法依次为{(1),(234)},{(2),(134)},{(3),(124)},{(4),(123)},{(12),(34)},{(13),(24)},{(14),(23)}。当n=6,r=3时,S(6,3)=______________。 (提示:先固定一个数,对于其余的5个数考虑S(5,3)与S(5,2),再分这两种情况对原固定的数进行分析。)
 
 
22.(最短路线)某城市的街道是一个很规整的矩形网络(见下图),有7条南北向的纵街,5条东西向的横街。现要从西南角的A走到东北角的B,最短的走法共有多少种?___________
 
 

23.看程序写结果:

#include<stdio.h>
int main()
{
	int i, p[5], a, b, c, x, y = 20;
	for ( i = 0; i <= 4; i++ )
		scanf( "%d", &p[i] );
	a = (p[0] + p[1]) + (p[2] + p[3] + p[4]) / 7;
	b = p[0] + p[1] / ( (p[2] + p[3]) / p[4]);
	c = p[0] * p[1] / p[2];
	x = a + b - p[(p[3] + 3) % 4];
	if ( x > 10 )
		y += (b * 100 - a) / (p[p[4] % 3] * 5);
	else
		y += 20 + (b * 100 - c) / (p[p[4] % 3] * 5);
	printf( "%d,%d\n", x, y );
	return(0);
}

{注:本例中,给定的输入数据可以避免分母为0或数组元素下表越界。} 输入:6 6 5 5 3

 

24.看程序写结果:

#include<stdio.h>
void fun( int *a, int *b )
{
	int *k;
	k = a; a = b; b = k;
}


main()
{
	int a = 3, b = 6, *x = &a, *y = &b;
	fun( x, y );
	printf( "%d,%d ", a, b );
}

 输出:_______________________________

 

25.看程序写结果:

#include "math.h"
#include "stdio.h"
main()
{
	int a1[51] = { 0 };
	int i, j, t, t2, n = 50;
	for ( i = 2; i <= sqrt( n ); i++ )
		if ( a1[i] == 0 )
		{
			t2 = n / i;
			for ( j = 2; j <= t2; j++ )
				a1[i * j] = 1;
		}
	t = 0;
	for ( i = 2; i <= n; i++ )
		if ( a1[i] == 0 )
		{
			printf( "%4d", i ); t++;
			if ( t % 10 == 0 )
				printf( "\n" );
		}
	printf( "\n" );
}

结果:(               )

 

26.看程序写结果:

#include "ctype.h"
#include "stdio.h"
void expand( char s1[], char s2[] )
{
	int i, j, a, b, c;
	j = 0;
	for ( i = 0; (c = s1[i]) != '\0'; i++ )
		if ( c == '-' )
		{
			a = s1[i - 1]; b = s1[i + 1];
			if ( isalpha( a ) && isalpha( b ) || isdigit( a ) && isdigit( b ) )
/*函数isalpha(a)用于判断字符a是否为字母,isdigit(b) 用于判断字符b是否为数字,如果是,返回1,否则返回0 */
			{
				j--;
				do
					s2[j++] = a++;
				while ( tolower( a ) < tolower( s1[i + 1] ) );
			}
/*函数tolower(a)的功能是当字符a是大写字母,改为小写,其余情况不变*/
			else s2[j++] = c;
		}else s2[j++] = c;
	s2[j] = '\0';
}


main()
{
	char s1[100], s2[300];
	printf( "input s1:" );
	gets( s1 );
	expand( s1, s2 );
	printf( "%s\n", s2 );
}

输入:wer2345d-h454-82qqq

 

27.完善程序:
(求字符的逆序)下面的程序的功能是输入若干行字符串,每输入一行,就按逆序输出该行,最后键入-1终止程序。请将程序补充完整。

#include <iostream.h>
#include <string.h>
int maxline = 200, kz;
int reverse( char s[] )
{
	int i, j, t;
	for ( i = 0, j = strlen( s ) - 1; i < j; 【①】 , 【②】 )
	{
		t = s[i]; s[i] = s[j]; s[j] = t;
	}
	return(0);
}


void main()
{
	char line[100];
	cout << "continue? -1 for end." <<endl;
	cin>>kz;
	while(【③】)
	{
		cin  >>  line;
		【④】;
		cout << line  <<  endl;
		cout << "continue ? -1 for end." << endl;
		cin >> kz;
	}
}
 

1.

2.

3.

4.

 
 
28.完善程序:

(棋盘覆盖问题)在一个2^k\times 2^k2k×2k个方格组成的棋盘中恰有一个方格与其它方格不同(图中标记为-1的方格),称之为特殊方格。现用L型(占3

个小方格)纸片覆盖棋盘上除特殊方格的所有部分,各纸片不得重叠,于是,用到的纸片数恰好是(4^k-1)/3(4k1)/3。在下表给出的一个覆盖方案中,k=2,

相同的3各数字构成一个纸片。下面给出的程序使用分治法设计的,将棋盘一分为四,依次处理左上角、右上角、左下角、右下角,递归进行。请将程序补充

完整。

2  2  3  3
2 -1  1  3
4  1  1  5
4  4  5  5
#include <iostream.h>
#include <iomanip.h>
int board[65][65], tile; /* tile为纸片编号 */
void chessboard( int tr, int tc, int dr, int dc, int size )
/* dr,dc依次为特殊方格的行、列号 */
{
	int t, s;
	if ( size == 1 )
		⑤ ;
		t = tile++;
	s = size / 2;
	if ( ⑥ )
		chessboard( tr, tc, dr, dc, s );
	else{
		board[tr + s -1][tc + s -1] = t;
		[⑦];
	}
	if ( dr < tr + s && dc >= tc + s )
		chessboard( tr, tc + s, dr, dc, s );
	else{
		board[tr + s -1][tc + s] = t;
		⑧;
	}
	if ( dr >= tr + s && dc < tc + s )
		chessboard( tr + s, tc, dr, dc, s );
	else{
		board[tr + s][tc + s -1] = t;
		[⑨];
	}
	if ( dr >= tr + s && dc >= tc + s )
		chessboard( tr + s, tc + s, dr, dc, s );
	else{ board[tr + s][tc + s] = t;
	      [⑩]; }
}


void prtl( int b[][65], int n )
{
	int i, j;
	for ( i =1; i <= n; i++ )
	{
		for ( j =1; j <= n; j++ )
			cout << setw( 3 ) << b[i][j];
		cout << endl;
	}
}


void main()
{
	int size, dr, dc;
	cout << "input size(4/8/16/64):" << endl;
	cin >> size;
	cout << "input the position of special block(x,y):" << endl;
	cin >> dr >> dc;
	board[dr][dc] = -1;
	tile++;
	chessboard( 1, 1, dr, dc, size );
	prtl( board, size );
}

1.

2.

3.

4.

5.

6.

 

答案

1.D  2.D  3.C  4.B  5.B  6.B  7.B  8.C  9.C  10.A  11.C  12.A  13.A  14.C  15.B  16.D  17.C  18.D  19.A  20.A 

21. 90    22. 210    23. 15,46    24. 3,6    25. 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47    26. wer2345d-h454-82qqq   27.(1)i++ / i=i+1 / i+=1    (2)j-- / j=j-1 / j-=1     (3)kz!=-1    (4)reverse(line)     28.(1)return    (2)(dr<tr+s)&&(dc<tc+s)    (3)chessboard(tr,tc,tr+s-1,tc+s-1,s)    (4)chessboard(tr,tc+s,tr+s-1,tc+s,s)    (5)chessboard(tr+s,tc,tr+s,tc+s-1,s)    (6)chessboard(tr+s,tc+s,tr+s,tc+s,s)

 

觉得不错,点个赞再走呗(逃

Guess you like

Origin www.cnblogs.com/weilinxiao/p/11621468.html