重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
找答案首页 > 全部分类 > 求职面试
搜题
网友您好, 请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
[单选题]

#include int main() { printf(“Hello,World!”); return 0; } 以上C语言程序的功能是()。

A.输出字符串:Hello

B.输出字符串:World!

C.输出字符串:Hello,World!

D.输入字符串

查看答案
更多“#include int main() { printf(“Hello,World!”); return 0; } 以上C语言程序的功能是()。”相关的问题

第1题

对于如下C语言程序

intmain(){

printf("HelloWorld\n");

fork();

printf("HelloWorld\n");}

在UNIX操作系统中正确编译链接后,其正确的运行结果是

A.共打印出2行HelloWorld

B.共打印出3行HelloWorld

C.共打印出4行HelloWorld

D.共打印出5行HelloWorld

点击查看答案

第2题

对于如下C语言程序 int main() { printf("Hello World\n"); fork(); printf("Hello World\n"); } 在UNIX操作系统中正确编译链接后,其正确的运行结果是

A.共打印出2行Hello World

B.共打印出3行Hello World

C.共打印出4行Hello World

D.共打印出5行Hello World

点击查看答案

第3题

对于如下C语言程序 int main() { pid_t pid; int x=1; pid = fork(); if(pid==0) printf("I am the child process, x=%d\n", ++x); else printf("I am the parent process, x=%d\n", --x); } 在UNIX操作系统中正确编译链接后,其正确的运行结果是

A.I am the child process, x=2

B.I am the parent process, x=0

C.I am the parent process, x=2

D.I am the child process, x=0

点击查看答案

第4题

有如下C语言程序 void * th_f(void * arg) { printf("Hello World"); pthread_yield(0); } int main(void) { pthread_t tid; int st; st = pthread_create(&tid, NULL, th_f, NULL); if(st==0) printf("Oops, I can not createthread\n"); exit(NULL); } 针对上述程序,下列叙述中哪一个是正确的?

A.线程th_f运行后主动退出

B.线程th_f运行后等待一个特定的线程退出

C.线程th_f运行后主动释放CPU给其他线程

D.线程th_f运行后进入等待态

点击查看答案

第5题

有如下C语言程序 void * th_f(void * arg) { printf("Hello World"); pthread_exit(0); } int main(voiD) { pthread_t tid; int st; st = pthread_create(&tid, NULL, th_f, NULL); if(st==0) printf("Oops, I can not createthread\n"); exit(NULL); } 针对上述程序,下列叙述中哪一个是正确的?

A.线程th_f运行后主动退出

B.线程th_f运行后等待一个特定的线程退出

C.线程th_f运行后主动释放CPU给其他线程

D.线程th_f运行后进入等待态

点击查看答案

第6题

有如下C语言程序 void * th_f(void * arg) { printf("Hello World"); pthread_join(2); } int main(void) { pthread_t tid; int st; st = pthread_create(&tid, NULL, th_f, NULL); if(st==0) printf("Oops, I can not createthread\n"); exit(NULL); } 针对上述程序,下列叙述中哪一个是正确的?

A.线程th_f运行后主动退出

B.线程th_f运行后等待一个特定的线程退出

C.线程th_f运行后主动释放CPU给其他线程

D.线程th_f运行后进入死循环

点击查看答案

第7题

C语言程序段“inta=10,b=15;printf("%d\n",a<=b);”的输出结果是A.3B.0C.4D.1
C语言程序段“inta=10,b=15;printf("%d\n",a<=b);”的输出结果是

A.3

B.0

C.4

D.1

点击查看答案

第8题

请教:2011年9月国家二级(C语言)笔试真题试卷第1大题第33小题如何解答?
【题目描述】

有以下程序

  #include<stdio.h>

  int f(int m)

  { static int n=0;

   n+=m:

   return n;

  }

main()

{ int n=0;

  printf("%d,",f(++n));

  printf("%d\n",f(n++));

}

  程序运行后的输出结果是A.1,2

B.1,1

C.2,3

D.3,3

【我提交的答案】:
【参考答案与解析】:

正确答案:A

答案分析:

解析:static变量用于局部变量中有记忆功能和全局生存期。函数中的静态变量的特点是每次调用函数,静态变量的值是上次调用完该函数后的静态变量值,所以在此题中,第一调用函数,返回1,此时函数中的静态变量n的值为l,所以第二次调用函数时,返回值为2。

第二次函数调用时 形参n++的值不是0吗,怎么会是1呢?

点击查看答案

第9题

阅读以下说明和C语言程序,将应填入(n)处的字句写在对应栏内。

【说明】

以字符流形式读入一个文件,从文件中检索出6种C语言的关键字,并统计、输出每种关键字在文件中出现的次数。本程序中规定:单词是一个以空格或'\t'、'\n'结束的字符串。其中6种关键字在程序中已经给出。

【程序】

include <stdio.h>

include <stdlib.h>

FILE *cp;

char fname[20], buf[100];

int NUM;

struct key

{ char word[10];

int count;

}keyword[]={ "if", 0, "char", 0, "int", 0,

"else", 0, "while", 0, "return", 0};

char *getword (FILE *fp)

{ int i=0;

char c;

while((c=getc(fp))!= EOF &&(1));

if(c==EOF)

return (NULL);

else

buf[i++]=c;

while((c=fgetc(fp))!=EOF && c!="&& c!='\t' && c!='\n' )

buf[i++]=c;

buf[i]='\0';

return(buf);

}

void lookup(char *p)

{ int i;

char *q, *s;

for(i=0; i<NUM; i++)

{ q=(2);

s=p;

while(*s && (*s==*q))

{ (3))

if((4))

{ keyword[i].count++;

break;

}

}

return;

}

void main()

{ int i;

char *word;

printf("lnput file name:");

scanf("%s", fname);

if((cp=fopen(fname, "r"))==NULL)

{ printf("File open error: %s\n", fname);

exit(0);

}

NUM=sizeof(keyword)/sizeof(struct key);

while((5))

lookup(word);

fclose(cp);

for(i=0;i<NUM;i++)

printf("keyword:%-20s count=%d\n",keyword[i].word,keyword[i].count);

}

点击查看答案

第10题

论述题 3 :针对以下 C 语言程序,请按要求回答问题( 18 分)

已知 link.c 源程序如下:

/*link.c 程序对单向链表进行操作 , 首先建立一个单向链表 , 然后根据用户的选择可以对其进行插入节点 、

删除节点和链表反转操作 */

#include

#include

typedef struct list_node *list_pointer; // 定义链表指针

typedef struct list_node{ // 定义链表结构

int data;

list_pointer link;

}list_node;

// 用到的操作函数:

list_pointer create(); // 建立一个单向链表

void insert(list_pointer *p_ptr, list_pointer node); // 在 node 后加入一个新的节点

void delete_node(list_pointer *p_ptr, list_pointer trail, list_pointer node);

// 删除前一个节点是 trail 的当前节点 node

void print(list_pointer ptr); // 打印链表节点中的值

list_pointer invert(list_pointer lead); // 反转链表

int main()

{

list_pointer ptr=NULL;

list_pointer node, trail;

list_pointer *p = &ptr;

int choose, location, i;

printf("you should create a link first:\n");

// 建立一个单向链表:

ptr=create(); /* ptr 指向链表的第一个节点 */

print(ptr);

// 根据用户的不同选择进行相应的操作:

printf("input number 0, you can quit the program\n");

printf("input number 1, you can insert a new node to link\n");

printf("input number 2, you can delete a node from the link\n");

printf("input number 3, you can invert the link\n");

printf("please input your choice\n");

scanf("%d", &choose);

while(choose!=0){

switch(choose){

case 1:

printf("you will insert a node to the link\n");

printf("please input the location of the node:\n");

scanf("%d", &location);

node = ptr;

i = 1;

while(i<location){

node = node->link;

i++;

}

insert(p, node); /* p 为指向 ptr 的指针 */

print(ptr);

break;

case 2:

printf("you will delete a node from the link\n");

printf("please input the location of the node:\n");

scanf("%d", &location);

node = ptr;

if(location ==1)

trail = NULL;

trail = ptr;

i = 1;

while(i<location){

trail = trail->link;

i++;

}

node = trail->link;

delete_node(p, trail, node);

print(ptr);

break;

case 3:

printf("you will invert the link\n");

ptr = invert(ptr);

print(ptr);

break;

default:

break;

return -1;

}

printf("please input your choice\n");

scanf("%d", &choose);

}

return 0;

}

// 根据用户的输入数值建立一个新的单向链表:

list_pointer create()

{

int i, current, length;

list_pointer p1, p2, head;

printf("please input the node number of the link:\n");

scanf("%d", &length);

printf("the number of the link is : %d\n", length);

printf("please input the data for the link node:\n");

i =0;

p1= p2= (list_pointer) malloc(sizeof(list_node));

head = p1;

for(i = 0; i

scanf("%d", ¤ t);

p1->data = current;

p2->link = p1;

p2 = p1;

p1 = (list_pointer) malloc(sizeof(list_node));

}

p2->link = NULL;

return head;

}

……

( 1 )画出主函数 main 的控制流程图。( 10 分)

( 2 ) 设计一组测试用例 , 尽量使 main 函数的语句覆盖率能达到 100% 。 如果认为该函数的语句覆盖率无法达到 100% ,需说明原因。( 8 分)

点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)
订单号:
遇到问题请联系在线客服
请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注上学吧 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注上学吧 -
请用微信扫码测试
选择优惠券
确认选择
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,如果您知道正确答案,欢迎您来纠错

上学吧找答案