首页 > 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

阅读下面代码 if(x= =0){System.out.println("冠军");) elseif(x>一3){System.Out.println(

阅读下面代码 if(x= =0){System.out.println("冠军");) elseif(x>一3){System.Out.println("亚军");} else{System.out.println("季军");} 若要求打印字符串”季军”,则变量X的取值范围是()。

A.x=d&x<=-3

B.x>O

C.x>-3

D.x<=-3

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“阅读下面代码 if(x= =0){System.out.pr…”相关的问题
第1题
阅读下面代码if(x==0){System.out.println("冠军");}else if(x>-3){System.out.println("亚军");

阅读下面代码 if(x==0){System.out.println("冠军");} else if(x>-3){System.out.println("亚军");} else{System.out.println("季军");} 若要求打印字符串“季军”,则变量X的取值范围是

A.x=0&x<=-3

B. x>0

C.x>-3

D.x<=-3

点击查看答案
第2题
阅读下面代码 fi(x==0) { System.out.println("冠军");} else if (x>-3) { System.out.println("

阅读下面代码 fi(x==0) { System.out.println("冠军");} else if (x>-3) { System.out.println("亚军"); } else { System.out.println("季军");} 若要求打印字符串“季军”,则变量x的取值范围是()。

A.x=0 & x<=-3

B.x>0

C.x>-3

D.x<=-3

点击查看答案
第3题
阅读下面代码 if(x==0){System.out.println("冠军"); else if(x>-3){System.out.println(“亚军”);} else {System.out.println(“季军”);} 若要求打印字符串“季军”,则变量x的取值范围是

A.x=0 & x<=-3

B.x>0

C.x>-3

D.x<=-3

点击查看答案
第4题
阅读下面代码 int x=3; while (x<9)x+=2; x++: while语句成功执行的次数是______。

阅读下面代码

int x=3;

while (x<9)x+=2;

x++:

while语句成功执行的次数是______。

点击查看答案
第5题
下面是一个面向连接的SOCKET实例,填入(n)处。 【说明】 代码实例中的服务器通过socket连接向客户端

下面是一个面向连接的SOCKET实例,填入(n)处。

【说明】

代码实例中的服务器通过socket连接向客户端发送字符串"Hello,you are connected!"。只要在服务器上运行该服务器软件,在客户端运行客户软件,客户端就会收到该字符串。

客户端程序代码如下:

include<stdio.h>

include<stdlib.h>

include<errno.h>

include<string.h>

include<netdb.h>

include<sys/types.h>

include<netinet/in.h>

include<sys/socket.h>

define SERVPORT 3333

define MAXDATASIZE 100 /*每次最大数据传输量*/

main(int argc, char*argv[]){

int sockfd, recvbytes;

char buf[MAXDATASIZE];

stmct hostent*host;

struct sockaddr_in serv_addr;

if (1) {

fprintf(stderr, "Please enter the server's hostname!\n");

exit(1);

}

if<(host=gethostbyname(argv[1]))=NULL) {

herror("gethostbyname出错!");

exit(1);

}

if ((sockfd = socket(AF_INET, (2), 0))=-1) {

perror("socket创建出错!");

exit(1);

}

serv_addr.sin_family=AF_INET;

serv_addr.sin_port=htons(SERVPORT);

Serv_addr.sin_addr=*((structin_addr*)host→h_addr);

bzero(&(serv_addr.sin_zero), 8);

if(connect (3), (struct sockaddr *)&serv_addr, \

sizeof(struct sockaddr))=-1) {

perror("connect出错!");

exit(1);

}

if((recvbytes=recv (4), buf, MAXDATASIZE, 0))=-1) {

perror("recv出错!");

exit(1);

}

buf[recvbytes]='\0';

pfintf("Received: %s", buf);

close(sockfd);

}

点击查看答案
第6题
阅读下面实现堆栈类并发控制的部分代码public class DataStack } private int idx=0; private in

阅读下面实现堆栈类并发控制的部分代码 public class DataStack } private int idx=0; private int[] data=new int[8]; public void push(int i) { ______ { data[idx]=I: idx++; } } … } 程序中下画线处应填入的正确选项是

A.synchronized

B.synchronized(this)

C.synchronized()

D.synchronized(idx)

点击查看答案
第7题
阅读下面代码class Test implements Runnable { public int run() { int i=0; while(true) {

阅读下面代码 class Test implements Runnable { public int run() { int i=0; while(true) { i++; System.out.println("i="+i); } } } 上述代码的编译结果是

A.程序通过编译,并且run()方法可以正常输出递增的i值

B.程序通过编译,调用run()方法将不显示任何输出

C.程序不能通过编译,因为while的循环控制条件不能为true

D.程序不能通过编译,因为run()方法的返回值类型不是void

点击查看答案
第8题
下面代码的输出结果是()x=list()y=0if x:y=1print(y)

A.0

B.1

C.没有输出

D.出错

点击查看答案
第9题
阅读下列程序说明和c代码,将应填入(n)处的字句写在对应栏内。[说明] 下面的程序利用递归算法计算x

阅读下列程序说明和c代码,将应填入(n)处的字句写在对应栏内。

[说明]

下面的程序利用递归算法计算x和y的最大公约数。

[函数2.1]

main ()

{ int x,y,k,t;

scanf(" % d% d" , &x, &y);

if(x>y) { t=x;x=y; y=t;}

(1);

while(k! =0){

y=x;

(2);

k=y%x;

}

prinff("% d" ,x); }

[函数2.2说明]

函数fun(char *str,char *substr的功能是计算子串sugbstr在串str中出现的次数。

[函数2.2]

fun(ehar * str, char * substr)

{ int x,y,z;

(3);

for(x=0;str[ x] ! = '\O';x + + )

for(y=x,z=0;sabstr[z] = =str[y];(4),y+ +)

if((5)= ='\0') {

num + +;

break;

}

return(num);

}

点击查看答案
第10题
阅读下面实现堆栈类并发控制的部分代码 public class DataStack{ private int idx=0; private in
t[]data=new int[8]; public void push(int i){ . ________________{ data[idx]=i; idx + +; } } } …… } 在程序下画线处填入正确选项是

A.synchronized

B.synchronized(this)

C.synchronized()

D.synchronized(idx)

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改