试题与答案

试题4阅读以下说明和C程序代码,将应填入______处的语句写在答题纸的对应栏内。[

题型:问答题

题目:

试题4
阅读以下说明和C程序代码,将应填入______处的语句写在答题纸的对应栏内。
[说明]
函数MultibaseOutput(long n,int B)的功能是:将一个无符号十进制整数n转换成 B(2≤B≤16)进制数并输出。该函数先将转换过程中得到的各位数字入栈,转换结束后再把B进制数从栈中输出。有关栈操作的诸函数功能见相应函数中的注释。C代码中的符号常量及栈的类型定义如下:
# define MAXSIZE 32
typedef struct
int * elem;/* 栈的存储区 */
int max; /* 栈的容量,即栈中最多能存放的元素个数 */
int top; /* 栈顶指针 */
Stack;
[C代码]
int InitStack(Stack * S,int n) / * 创建容量为n的空栈 */
S->elem=(int *)malloc(n * sizeof(int));
if(S->elem==NULL)return-1;
S->max=n; (1) =O;return 0;

int Push(Stack * S,int item) / * 将整数item压入栈顶 * /
if(S->top==S->max) printf(“Stack is full! \n”);return-1;
(2) =item;return 0;

int StackEmpty(StackS) return (! S.top) 1:0; / * 判断栈是否为空 * /
int Pop(Stack *S ) / * 栈顶元素出栈 * /
if(! S->top)printf(“Pop an empty stack! \n”);return-1;
return (3)

void MultibaseOutput(long n,int B)
int m;StackS;
if (InitStack(&S,MAXSIZE))printf(“Failure! \n”);return;
do
if(Push(&S, (4) ))printf(“Failure! \n”);return;
n= (5)
while(n!=0);
while(! StackEmpty(S)) / * 输出B进制的数 * /
m=Pop(&S);
if(m<10)printf(“%d”,m); / * 小于10,输出数字 * /
else printf(“%c”,m+55); / * 大于或等于10,输出相应的字符 * /

printf(“\n”);


答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0415/cec7058e76fa3537decf6d1656fb4390.html

下面是错误答案,用来干扰机器的。

A、23和32不是同类二次根式,不能合并,故A错误;B、53•52=256,故B错误;C、8=22,所以8÷2=22÷2=2;故C正确;D、(-6)2=|-6|=6,故D错误.故选C.

试题推荐
题型:阅读理解

 The greatest recent social changes have been in the lives of women. During the twentieth century there has been a remarkable shortening of the time of a woman’s life spent in caring for children. A woman marrying at the end of the nineteenth century would probably have been in her middle twenties, and would be likely to have seven or eight children, of whom four or five lived till they were five years old. By the time the youngest was fifteen, the mother would have been in her early fifties and would expect to live a further twenty years, during which health made it unusual for her to get paid work. Today women marry younger and have fewer children. Usually a woman‘s youngest child will be fifteen when she is forty-five and can be expected to live another thirty-five years and is likely to take paid work until retirement(退休) at sixty. Even while she has the care of children, her work is lightened by modern living conditions.

  This important change in women’s life-pattern has only recently begun to have its full effect on women‘s economic position. Even a few years ago most girls left schools at the first chance, and most of them took a full-time job. However, when they married, they usually left work at once and never returned to it. Today the school-leaving age is sixteen, many girls stay at school after that age, and though women usually marry younger, more married women stay at least until shortly before their first child is born. Very many more afterwards return to full or part-time work. Such changes have led to a new relationship in marriage, with the husband accepting a greater share of the duties and satisfactions of family life, and with the both husband and wife sharing more equally in providing the money, and running the home, according to the abilities and interests of each of them.

 小题1:According to the passage, around the year 1900 most women married ________.

  A. at about twenty-five B. in their early fifties

  C as soon as possible after they were fifteen

  D. at any age from fifteen to forty-five

 小题2: We are told that in a common family about 1900 _________.

A.many children died before they were five

B.seven or eight children lived to be more than five

C.the youngest child would be fifteen

D.four or five children died when they were five小题3:When she was over fifty, the late nineteenth-century mother _________.

A.would be healthy enough to take up paid jobs

B.was usually expected to die fairly soon

C.would expect to work until she died

D.was unlikely to find a job even if she wanted one小题4:According to the passage, the women of today usually _________.

A.marry instead of getting paid work

B.marry before they are twenty-five

C.have more children under fifteen

D.have too few children

查看答案
微信公众账号搜索答案