首页 > 其他分享 >2021年湖南省对口高考真题

2021年湖南省对口高考真题

时间:2023-07-29 11:01:36浏览次数:32  
标签:return struct 真题 int 对口 pNewItem ____ item 2021

一、选择题

1、

若"int a=-7,b=-1;",执行 "a%=b-1;"后,a的值是__________。         

A.-7               B.-1               C.-2               D.-3

2、

C语言程序从程序中的__________开始执行。

A.第一条语句                           B.第一条可执行语句

C.main函数                            D.第一个函数

3、

若" char a[8]="1234";int x=strlen(a),y=sizeof(a);",

则x和y的值分别是__________。

A.4,4              B.5,4              C.4,5              D.4,8

二、程序填空题

1、

计算圆的面积s(公式为s=3.14π2)。请补全下列代码

#include "stdio.h" 
_____ 1 _____ 3.14
_____ 2 _____
main()
{
    float r=2.5;
    float area=0.0;
    area=_____ 3 _____
    printf("area=%f\n",_____ 4 _____);
    return 0;
}
float
ComputeArea(float r)
{   return (PI*r*r);  }

三、写程序结果

1、

下列程序运行时,若输入:12345,则程序的输出结果是__________。

#include "stdio.h" 
main()
{
    char a,b;
    scanf("%c%*2c%c",&a,&b);
    printf("%c%c\n",a,b);
    return 0;
}

2、

下列程序的运行结果是__________。

#include "stdio.h" 
main()
{
    int a=5,b=6,result=0;
    result=(a>b)?(a>>1):(b<<1);
    printf("result=%d\n",result);
    return 0;
}

3、

下列程序的运行结果是__________。

#include "stdio.h" 
main()
{
    int i=0,j=0;
    do
    {
        printf("%d:",i);
        for(j=i;j<10;j++)
        {
            printf("%d",j);
        }
        printf("\n");
    }while(++i<1);
    return 0;
}

4、

下列程序的运行结果是__________。

#include "stdio.h" 
int a=5;
main()
{
    int a=3;
    {
        int a=1;
        a++;
    }
    printf("a=%d\n",a++);
    return 0;
}

5、

下列程序的运行结果是__________。

#include "stdio.h" 
func(int n)
{
    if(!n) return 0;
    printf("%d",n);
    return func(--n);
}
main()
{
    int a=9;
    func(a);
    return 0;
}

四、程序填空

1、

下列程序的功能是使用二分查找法在给定数组中查询某个数据。

#include <stdio.h>
int binarySearch(____ 1 ____,int bound,int value)
{
    int lowKey=0,highKey=0,midKey=0,midValue=0;
    highKey=____ 2 ____;
    while(lowKey<=highKey)
    {
        midKey=____ 3 ____;
        midValue=lib[midKey];
        if(midValue<value )
            lowKey=midKey+1;
        else if (midValue>value)
            highKey=midKey-1;
        else
            return  midKey;
    }
    ____ 4 ____;
}
int main()
{
    int i=0,value=0,result=0;
    int lib[10]={-20,-5,8,11,26,31,42,55,64,79};
    for (i=0; i<10; i ++)
        printf ("%d\t",lib[i]);
    printf("\n输入要查找的数:");
    scanf ("%d",____ 5 ____);
    result =binarySearch(lib,10,value);
    if (-1==result)
        printf ("查找失败\n");
    else
        printf ("查找成功 index=%d\n",result);
    return 0;
}

五、改错

1、

下列程序的功能是:输入不超过10个数,交换其中最大数和最小数的位置。

该程序只允许修改三行。

#include "stdio.h" 
#define ARR_SIZE 10;
void MaxMinExchang(int a[],int n)
{
    int maxValue=a[0],minValue=a[0],maxPos,
    int i,temp;
    for(i=0;i<n;i++){
        if(a[i]>maxValue){
            maxValue=a[i];
            maxPos=i;
        }
        else{
            minValue=a[i];
            minPos=i;
        }
    }
    temp=a[maxPos];
    a[maxPos]=a[minPos];
    a[minPos]=temp;
}
main()
{
    int data[ARR_SIZE],i,n;
    printf("Input n(n<10):");
    scanf("%d",&n);
    printf("Input %d Numbers:\n",n);
    for(i=0;i<n;i++){
        scanf("%d",data[i]);
    }
    MaxMinExchang(data,n);
    printf("After MaxMinExchange:\n");
    for(i=0;i<n;i++){
        printf("%d ",data[i]);
    }
    printf("\n");
    return 0;
}

2、

下列程序的功能是:寻找斐波拉切数列中的第n个数

斐波拉切数列的定义为:Fib(0)=0; Fib(1)=1; Fib(n)= Fib(n-1)+ Fib(n-2)(n>=2,n∈N);

以下程序只允许修改两行。

#include "stdio.h" 
unsigned long Fib(int n)
{
    if(n<0){
        printf("data error!\n");
        return 0;
    }else if(n==0||n==1){
        return 1;
    }else{
        return Fib(n-1,n-2);
    }
}
main()
{
    int n;
    long fn;
    printf("Input n:");
    scanf("%d",&n);
    fn=Fib(n);
    printf("fib(%d)=%ld\n",n,fn);
    return 0;
}

六、程序设计题

1、

下列程序的功能是:输入两个多项式(每个多项式中的各项都必须按指数从小到大的顺序输入),输入多项式之和。请将程序补充完整,每空可写多条语句。

#include "stdio.h"
#include "stdlib.h"
struct item
{
    int co; //系数
    int ex; //指数 
    struct item *next; 
};
int BuildList(struct item **ppHead);    //输入多项式 
void DisplayList(struct item *phead);   //显示多项式 
int FreeList(struct item **ppHead);     //销毁多项式 
int AddList(struct item *pListAHead,struct item *pListBHead,struct item **ppListCHead);//加法 
int main()
{
    int rv=0;
    struct item *pListAHead=NULL,*pListBHead=NULL,*pListCHead=NULL;
    if(BuildList(&pListAHead) || BuildList(&pListBHead))
    {
        printf("Build List error.\n");
        return 0;
    }
    rv=AddList(____ 1 ____);
    if(rv)
    {
        printf("AddList error.\n");
        return 0;
    }
    DisplayList(pListAHead);
    DisplayList(pListBHead);
    DisplayList(pListCHead);
    FreeList(&pListAHead);
    FreeList(&pListBHead);
    FreeList(&pListCHead);
    return 0;       
} 
int BuildList(struct item **ppHead)
{
    int i=0,n=0;
    struct item *pTail=NULL;
    struct item *pNewItem=NULL;
    printf("Please input total item number");
    scanf("%d",&n);
    if(n<1)
        return 0;
    pTail=(struct item *)malloc(sizeof(struct item));
    if(!pTail)
        return -1;
    printf("please input coefficient and exponent(1):");
    scanf("%d%d",&pTail->co,&pTail->ex);
    *ppHead=pTail;
    for(i=1;i<n;i++)
    {
        pNewItem=(struct item *)malloc(sizeof(struct item));
        if(!pNewItem)
            return -1;
        printf("please input coefficient and exponent(%d):",i+1);
        scanf("%d%d",&pNewItem->co,&pNewItem->ex);
        pNewItem->next=NULL;
        ____ 2 ____;
    }
    return 0;   
} 
void DisplayList(struct item *pHead)
{
    if(!pHead)
        return;
    printf("f(x)=%dx%d",pHead->co,pHead->ex);
    pHead=pHead->next;
    while(pHead)
    {
        printf("+%dx%d",pHead->co,pHead->ex);
        pHead=pHead->next;
    }
    printf("\n");
}
int FreeList(struct item **ppHead)
{
    struct item *pItem=NULL;
    struct item *pNextItem=NULL;
    if(!ppHead || !*ppHead)
        return 0;
    pItem=*ppHead;
    while(pItem)
    {
        ____ 3 ____;
    }
    *ppHead=NULL;
    return 0;
}
int AddList(struct item *pListAHead,struct item *pListBHead,struct item **ppListCHead)
{
    struct item *pListAItem=pListAHead;
    struct item *pListBItem=pListBHead;
    struct item *pItem=NULL;
    struct item *pNewItem=NULL;
    struct item *pTailItem=NULL;
    if(!pListAItem && !pListBItem)
        return 0;
    if(*ppListCHead)
        *ppListCHead=NULL;
    while(pListAItem && pListBItem)
    {
        pNewItem=(struct item *)malloc(sizeof(struct item));
        if(!pNewItem)
            return -1;
        pNewItem->next=NULL;
        if(pListAItem->ex<pListBItem->ex)
        {
            pNewItem->ex=pListAItem->ex;
            pNewItem->co=pListAItem->co;
            pListAItem=pListAItem->next;
        }
        else
			if(pListAItem->ex>pListBItem->ex)
        	{
            	pNewItem->ex=pListBItem->ex;
            	pNewItem->co=pListBItem->co;
            	pListBItem=pListBItem->next;
        	}
        	else
        	{
            	____ 4 ____;
        	}
        if(!*ppListCHead)
            *ppListCHead=pTailItem=pNewItem;
        else
            pTailItem=pTailItem->next=pNewItem;
    }
    if(pListAItem)
        pItem=pListAItem;
    else if(pListBItem)
        pItem=pListBItem;
    while(pItem)
    {
        pNewItem=(struct item *)malloc(sizeof(struct item));
        if(!pNewItem)
            return 0;
        pNewItem->ex=pItem->ex;
        pNewItem->co=pItem->co;
        pNewItem->next=NULL;
        ____ 5 ____;
        if(!*ppListCHead)
            *ppListCHead=pTailItem=pNewItem;
        else
            pTailItem=pTailItem->next=pNewItem;
    }
    return 0;   
}

参考答案:

一、选择题

1—3    B、C、D

二、程序填空题

1、#define PI                  2、float ComputeArea(float r);

3、ComputeArea(r);             4、area

三、写程序结果

1、14               2、result=12            3、0:0123456789         4、a=3         

5、987654321

四、程序填空

1、int lib[10]                                

2、bound-1 或者lowKey+bound-1

3、(lowKey+highKey)/2      4、return -1;       5、&value

五、改错

1、

L02     #define ARR_SIZE 10//#define ARR_SIZE 10;

L12     else if(a[i]<minValue) { //else{

L28     scanf("%d",&data[i]);//scanf("%d",data[i]);

L05     int maxValue=a[0],minValue=a[0],maxPos,minPos;

也应该有错,maxPos,minPos均没有赋初值,若第一个就为最小值,则minPos无初值。

2、

L08     return n;//return 1;

L10     return Fib(n-1)+Fib(n-2);//return Fib(n-1,n-2);

其实第二行可能也有转换问题

L02     long Fib(int n)//unsigned long Fib(int n)

六、程序设计题

1、 pListAHead,pListBHead,&pListCHead 

2、 pTail->next=pNewItem;

    pTail=pTail->next; 

3、 pNextItem=pItem->next;

    free(pItem);

    pItem=pNextItem; 

4、 pNewItem->ex=pListAItem->ex;

    pNewItem->co=pListAItem->co+pListBItem->co;

    pListAItem=pListAItem->next;

    pListBItem=pListBItem->next;   

5、 pItem=pItem->next;

 

 

标签:return,struct,真题,int,对口,pNewItem,____,item,2021
From: https://blog.51cto.com/teacherzhou/6890996

相关文章

  • 2019年湖南省对口高考真题
    一、选择题1、已知"intw=1,x=2,y=3,z=4;",则表达式"w>x?w:z>y?z:x"的值是__________。A.1               B.2               C.3               D.42、若有定义语句"inta[3][5];",按内存中的数据存放顺序,a数组的第10个元素是_____......
  • 2020年湖南省对口高考真题
    一、选择题1、在C语言中,用__________表示逻辑值“真”。A.T               B.F               C.非零整数        D.02、执行“inta=3;a+=a^2;”后,则a的值是__________。A.12              B.9            ......
  • remote: Support for password authentication was removed on August 13, 2021
    一、问题描述remote:SupportforpasswordauthenticationwasremovedonAugust13,2021.Pleaseuseapersonalaccesstokeninstead.具体如下:  大概意思:你原先的密码凭证从2021年8月13日开始就不能用了,必须使用个人访问令牌(personalaccesstoken),就是把你的密码替......
  • [SWPUCTF 2021 新生赛]pop
    [SWPUCTF2021新生赛]pop题目来源:nssctf题目类型:web涉及考点:PHP反序列化、pop链1.上来先做代码审计<?phperror_reporting(0);show_source("index.php");classw44m{private$admin='aaa';protected$passwd='123456';publicfunction......
  • 谷歌、苹果、亚马逊等大厂技术面试真题
    技术面试题是许多顶尖科技公司面试的主要内容,其中一些难题会令许多面试者望而却步,但其实这些题是有合理的解决方法的。7.1准备事项多数求职者只是通读一遍问题和解法,囫囵吞枣。这好比试图单凭看问题和解法就想学会微积分。你得动手练习如何解题,单靠死记硬背效果不彰。就本书的面......
  • 图论2021版
    图基本概念图可以理解成一个二元组,是由点集V和边集E组成的。G=(V,E),V表示点的集合,E表示边的集合。每条边是一幅点对(v,w)v,w都是点集V中的点。(v,w∈V)图的分类:可以按照边有无方向,可以分为有向图和无向图。比如上图1中,边AB之间没有画出方向(即点之间是无序的),这就是无向图。......
  • [SWPUCTF 2021 新生赛]babyrce
    [SWPUCTF2021新生赛]babyrce题目来源:nssctf题目类型:web涉及考点:Cookie注入、代码审计1.上来先代码审计<?phperror_reporting(0);header("Content-Type:text/html;charset=utf-8");highlight_file(__FILE__);if($_COOKIE['admin']==1){include"../next.p......
  • 2017年湖南省对口高考真题
    一、选择题1、下列C语言标识符错误的是__________。A.ABc              B.abc              C.A_bc             D.Ab.c2、分析以下程序,下列说法正确的是__________。#include<stdio.h>voidmain(){intx=3,a=3,b=3;if(x......
  • 逆袭!裸辞26天,历经4面,60w“跳”进鹅厂(附面试流程和真题)
    在互联网做了几年之后,去大厂“镀镀金”是大部分人的首选。大厂不仅待遇高、福利好,更重要的是,它是对你专业能力的背书,大厂工作背景多少会给你的简历增加几分竞争力。但说实话,想进大厂还真没那么容易。我的一个朋友在入职腾讯之前,大大小小的面试经历了十几次,最后终于在4轮技术面+1......
  • 题解:【ICPC WF 2021 L】 Where Am I?
    题目链接这年WF较为简单的一道了,直接模拟即可。首先可以预处理出它顺时针螺旋轨迹的移动步数,方便过会算距离直接查表。我偷懒直接用map记录的距离表,这样不用处理复数下标的问题。注意到\(X\)的数量不会超过\(100\)个,所以我们可以反过来从标记点上入手。找出所有的标记点,......