题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-26 05:35:17

[单项选择]
(48)~(50)题以下程序的功能是:建立一个带布头结点的单向链表,并将存储在数组中的字符依次存储到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项
  #include <stdlib.h>
  struct node
  char data; struct node *next;;
  (48) CreatList(char*s),
  struct node *h,*p,*q;
   h=(struct node*)malloc(sizeof(struct node));
   p=q=h;
   while(*s!="//0")
   p=(struct node*)malloc(sizeof(struct node));
    p->data= (49)
   q->next=p;
   q= (50)
   s++;
  
    p->next="//0";
    return h;
  
  main( )
   char str[]="link list";
    struct node*head;
    head=CreatList(str);
  …

A. char*
B. struct node
C. struct node*
D. char

更多"(48)~(50)题以下程序的功能是:建立一个带布头结点的单向链表,并"的相关试题:

[填空题]以下程序的功能是建立一个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输入数据为-1时,表示输入结束(链表头结点的data域不放数据,表空的条件是ph->next==NULL),请填空。
#include <stdio.h>
struct list int data;struct list *next;;
struct list *creatlist( )
struct list *p,*q,*ph;int a;ph=(struct list*)malloc(sizeof(struct list));
p=q=ph;printf("Input an integer number;entre-1 to end:/n");
scanf("%d",&a);
while(a!=-1)
p=(struct list*)malloc(sizeof(struct list));
______=a;q->next=p;______=p;scanf("%d",&a);
p->next=’/0’;return(ph);
main( )
stuct list * head;head=creatlist( );
[单项选择]以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下画线处号码对应的一组选项中选择正确的选项。
#include <stdio.h>
struct node
char data; struct node *next; ;
(48) CreatList(char *s)
struct node *h, *p, *q;
h=(struct node *)malloc(sizeof(struct node));
p=q=h;
while (*s!=’/0’ )
p=(struct node *)malloc(sizeof(struct node));
p->data= (49) ;
q->next=p;
q= (50) ;
s++;

p->next=’/0’;
return h ;

main( )
char str[]="link list";
struet node *head ;
head=CreatList(str) ;



A. char *
B. stmct node
C. struct node*
D. char
[单项选择]第48~50题基于以下信息。以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请从与下划线处号码对应的一组选若中选择出正确的选项。   #include   stuct node   { char data; struct node *next;};    (48) CreatList(char *s)   { struct node *h,*p,*q);    h=(struct node *)malloc(sizeof(struct node));    p=q=h;    while(*s!=’’/0’’)    { p=(struct node *)malloc(sizeof(struct node));    p->data= (49) ;    q->next=p;    q= (50) ; s++;    }    p->next=’’/0’’;    return h;   }   main( )   { char str[ ]="link list";    struct node *head;    head=CreatList(str);    ...   }
A. char *
B. struct node
C. struct node*
D. char
[单项选择]
(48)~(50)以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项。
  #include <stdlib.h>
  struct node
   char data; struct node *next;;
  (48) CreatList(char *s)
   struct node *h,*p,*q;
  h=(struct node *)malloc(sizeof(Struct node));
  p=q=h;
  while(*s!=‘//0’)
   p=(struct node *)malloc(sizeof(struct node));
  p->data=(49);
  q->next=p;
  q=(50);
  s++;
  
  p->next=0;
  return h;
  
  main( )
   char str[]="link list";
  struct node *head;
  head=CreatList(str);

A. char*
B. stmct node
C. strumnode*
D. char
[简答题]下列给定程序是建立一个带头结点的单向链表,并用随机函数为各结点数据域赋值。函数fun( )的作用是求出单向链表结点(不包括头结点)数据域中的最大值,并且作为函数值返回。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
typedef struct aa
int data;
struct aa *next;
NODE;
/*************found**************/
fun (NODE *h)
int max=-1;
NODE *p;
p=h->next;
while(p)
if(p->data>max)
max=p->data;
/*************found**************/
p=h->next;

return max;

outresult(int s, FILE *pf)
fprintf(pf, "/nThe max in link :%d/n
",s);
NODE *creatlink(int n, int m)
NODE *h,*p,*s,*q;
int i, x;
h=p=(NODE *)malloc(sizeof(NODE));
h->data=9999;
for(i=1;i<=n;i++)
s=(NODE *) malloc(sizeof(NODE));
s->data=rand( )%m; s->next=p->next;
p->next=s; p=p->next;
[填空题]下列给定程序中已建立一个带头结点的单向链表,链表中的各结点按结点数据域中的数据递增有序链接。函数fun的功能是:把形参x的值放入一个新结点并插入链表中,使插入后各结点数据域中的数据仍保持递增有序。
请在下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <stdlib.h>
#define N 8
typedef struct list
int data;
struct 1ist * next;
SLIST;
void fun(SLIST * h, int x)
SLIST * P, * q, * s;
s=(SLIST* )malloc(sizeof(SLIST));
/********** found********** /
s->data=______;
q=h;
p=h->next;
while(p! =NULL && x>p->data)
/********** found********** /
q=______;
p=p->next;

s->next=p;
/********** found********** /
q->next=______;

SLIST * creatlist(int * a)
SLIST * h, * p, * q; int i;
h=p=(SLIST * )malloc(sizeof(SLIST));
for(i=0; i<N; i ++)
q=(SLIST * )malloc(sizeof(SLIST));
q->data=a[i]; p->next=q; p=q;

p->next=0;
return h;

voi
[简答题]下列给定程序中,已建立一个带头结点的单向链表,链表中的各结点按结点数据域中的数据递增有序链接。函数fun的功能是:把形参x的值放入一个新结点并插入链表中,使插入后各结点数据域中的数据仍保持递增有序。
请在下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <stdlib .h >
#define N 8
typedef struct list
int data;
struct list * next;
SLIST;
void fun(SLIST * h, int x)
SLIST * p, * q, * s;
s=(SLIST *) malloc (sizeof
(SLIST));
/********** found********** /
s->data= (1) ;
q=h;
p=h->next;
while(p!=NULL && x >p->data)
/********** found********** /
q= (2) ;
p=p->next;

s->next=p;
/********** found********** /
q->next= (3) ;

SLIST * creatlist(int * a)
SLIST * h, * p, * q; int i;
h=p=(SLIST *)malloc (sizeof
(SLIST));
for(i=0; i<N; i++)
q=(SLIST *)malloc (sizeof
(SLIST));
q->data=a[i]; p->next=q; p=q;
[单项选择](48)~(50)以下程序的功能足:建立一个带有头结点的甲—向链表,并将存储在数组中的字符依次转存到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项。
#include <stdlib.h>
struct node
char data; struct node *next: ;
(48) CreatList(char *s)

struct node *h,*p,*q;
h = (struct node *)malloc sizeof(struct node));
p=q=h;
while(*s! =’/0’)

p = (struct node *)malloc(sizeof (struct node));
p->data = (49) ;
q->next = p;
q - (50) ;
S++;

p->next=’/0’;
return h;

main( )

char str[]="link list";
struct node *head;
head = CreatList(str);


A. char*
B. struct node
C. struct node*
D. char

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码