新祥旭考研官网欢迎您!


2014北工大计算机考研复试笔试真题

【新祥旭考研私塾】 / 2015-10-19

 //C语言第一题

#include <stdio.h>

char *fun1(char *s,char *ct)

{

        char *st=s;

        while(*s)

                s++;

        while(*s++=*ct++)

                ;

        return st;

}

char *fun2(char *s)

{

        char tmp,*tmp1=s,*tmp2=s;

        while(*tmp2)

                tmp2++;

        tmp2--;

        while(tmp2-tmp1>0)

        {

                tmp = *tmp1;

                *tmp1=*tmp2;

                *tmp2=tmp;

                tmp1++;

                tmp2--;

        }

        return s;

}

char *fun3(char *cs,char c)

{

        while(*cs!=c

                && *cs)

                cs++;

        if(*cs==0)

                cs=NULL;

        return (char *)cs;

}

void main()

{

        char a[50]="The first blow ";

        char b[50]="is half the battle";

        printf("%s\n",fun1(a,b));

        printf("%s\n",fun2(a));

        printf("%s\n",fun3(a,'i'));

        return;

        

}

1.    fun1,fun2,fun3 的作用

fun1:把字符串 ct 连接在字符串 s 后面

fun2:字符串逆转

fun3:查找字符串 cs 中第一次出现字符 c 的位置


2.写出程序执行的结果:


The first blow is half the battle


elttab eht flah si wolb tsrif ehT


i wolb tsrif ehT


//第二题:输入若干行文字,以空行结束,统计每行出现的字母,用链表表示,链表的结构


体定义给出来了。


问题:1.用流程图或伪代码描述程序


2.用 C 语言实现程序。


3.实现输出函数 output(Node*);

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

struct Node{

        char ch;

        int oc;

        Node *next;

};

void output(Node *list)

{

        printf("字母\t 出现次数\n");

        while(list)

        {

                printf("%c\t%d\n",list->ch,list->oc);

                list = list->next;

        }

        return;

}

void main()

{

        Node *list = NULL;

        char buf[80] = {0};

        gets(buf);

        while(strlen(buf))

        {

        

                char *p = buf;

                while(*p)

                {

                        Node *pNode = list;

                        while(pNode)

                        {

                                if(*p == pNode->ch)

                                {

                                        pNode->oc++;

                                        break;

                                }

                                else

                                        pNode = pNode->next;

                        }

                        if(!pNode)

                        {

                                if(list == NULL)

                                {

                                        list = (Node*)malloc(sizeof(Node));

                                        list->next = NULL;

                                        list->ch = *p;

                                        list->oc = 1;

                                }

                                else

                                {

                                        pNode = (Node*)malloc(sizeof(Node));

                                        pNode->ch = *p;

                                        pNode->oc = 1;

                                        pNode->next = list->next;

                                        list->next = pNode;

                                }

                        }

                        p++;

                }

                gets(buf);

        }

        output(list);

        return;

}


数据库部分

一:填空题

1.数据模型的三要素

2.数据库系统与数据库管理系统的区别

3.码键的两个条件()和() ,R(A,B,C,D)A→B,C→D,CB→A,B→C,所有的键是()

4.选择对应于 SQL 的什么语句

5.R(A,B,C)键码为 AC 或 AB,该关系最高达()范式,为什么()

6.三级体系结构引出的两层数据独立性是什么()

7.R(U)分解为 R1(U1),R2(U2),无损连接的条件是

二.大题

1.设计数据库存储每个人的父母和孩子。给出 ER 模型和数据模型

查询王立的父母,用关系代数和 SQL 语句分别给出

能否查询祖父母信息

2.R(A,B,C,D,E,F) F={A→B,AC→D,BE→F,EF→C},分解成 3NF,使保持依赖

3.大学学习数据库有否上机课程,是干什么的,用的哪个 DBMS,它提供哪些基本工具, 使

用是否方便。你是否使用过编程语言连接数据库,如何连接的。

全方位权威辅导,考研复试效率高

面授一对一
在线一对一
魔鬼集训营
咨询课程 预约登记

以效果为导向    以录取为目标

填写信息获取考研一对一试听名额
姓名:
电话:
报考学校及专业:
北清考研定制 985考研定制 211考研定制 学硕考研定制 专硕考研定制 北京考研私塾
x