更多"阅读下列程序,则程序的输出结果为______。
#include'"的相关试题:
[单项选择]下列程序的输出结果是( )。
#include<stdio.h>
main( )
struct st
int y,x,z;
;
union
long i;
int j;
char k;
un;
printf("%d,%d/n",sizeof(struct st),sizeof(un));
A. 6,2
B. 6,4
C. 8,4
D. 8,6
[填空题]以下程序运行后的输出结果是 【11】 。
#include <stdio.h>
struct NODE
int num;struct NODE * next;
main ( )
struet NODE s[3]= .’/0’,2,’/0’,3,’/O’,*p,*q,*r;
int sum = 0;
s[0].next=s+1; s[1].next=s+2;s[2].next=s;
p=s; q=p->next; r=q->next:
sum+=q->next->num; sum+=r->next->next->num;
prinff( "% d /n", sum);
[填空题]
以下程序运行时输出到屏幕的结果中第一行是()第二行是()
#include
Typedef struct
{int dm; /*产品代码*/
Char *mc; /*产品名称*/
Long je; /*金额*/
}PRO;
Void main( )
{ int I j,k,n=3;
PRO
sell[10]={{101,apple,100},{301,orange,100},{101,apple,200}},xy;
For(i=0;i { k=I;
For(j=i+1;j If(sell[k].dm If(k!=i)
{xy=sell[i];
Sell[i]=sell[k];
Sell[k]=xy;
}
}
For(i=0;i Printf(%15d%10s%5d/n,sell[i].dm_sell[i].mc.sell[i].je);
}
[单项选择]有以下程序 #include<stdio.h> #include<string.h> Struct A {int a;char b[10];double c;}; struct A f(struct A t); main( ) {struct A a={1001,"ZhangDa",1098.0}; a=f(a);printf("%d,%s,%6.1f/n",a.a,a.b,a.c); } struct A f(Struct A t) {t.a=1002;strcpy(t.b,"WangPeng");t.c=1220.0;return t;} 程序运行后的输出结果是( )。
A. 1001,ZhangDa,1098.0
B. 1002,ZhangDa,1220.0
C. 1001,WangPeng,1098.0
D. 1002,WangPeng,1220.0
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class35
public static void main(String[] args)
String s1=new String("0860371"),s2="0860371";
System. out. println(s1==s2);
System. out. println(s1. equals(s2));
System. out. println(s1. endsWith(s2)==s1. startsWith(s2));
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class32
public static void main(String[] args)
boolean x=true,y=false,z=false;
x=x&&y||z;
y=x||y&&z;
z=!(x!=y)||(y==z);
System. out. println(x+","+y+","+z);
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class33
public static void main(String[] args)
int a,b,c;
a=b=c=1;
boolean w;
w=a++>1&&++b>c++:
System. out. println(a+","+b+","+c+","+w);
[简答题]阅读以下程序代码,写出程序的输出结果。
import java. util.*;
public class Class36
public static void main(String[] args)
String s1="public static void,main(String[] args)";
StringTokenizer s2=new StringTokenizer(s1,",( )[]");
int n=s2. countTokens( );
System. out. println (n);
while(s2. hasMoreTokens( ))
System. out. println(s2. nextToken ( ));
[简答题]
阅读下列程序,请写出该程序的输出结果。
class Test33 {
static int merger(int [] a, int []b, int []c){
int i = 0, j = 0, k = 0;
while(i < a.length && j < b.length) {
if(a[i] < b[j])c[k++] = a[i++];
else c[k++] = b[j++];
}
while(i < a.length) c[k++] = a[i++];
while(j < b.length) c[k++] = b[j++];
return k;
}
public static void main(String[] args) {
int a[] = {3, 6, 9};
int b[] = { 1, 2, 5};
int []c = new int[100];
int p = merger(a, b, c);
for(int k = 0; k < p; k++)
System.out.print(c[k]+ (k < p-1 " ":"/n"));
}
[填空题]阅读下列程序,则程序的输出结果为 【16】 。
#include"stdio.h"
struct ty
int data;
char c;;
main( )
struct ty a=30,’x’;
fun(a);
printf("%d%c",a.data,a.c);
fun(struct ty b)
b.data=20;
b.c=’y’;
[简答题]阅读下列程序,请写出该程序的输出结果。
public class C
int x=10;
static int y=20;
public static void main(String[] args)
C obj1=new C( );
C obj2=new C( );
obj1.x*=2;
obj1.y*=3;
obj2.x+=4;
obj2.y+=5;
System. out. println(obj1.x);
System. out. println(obj1.y);
System. out. println(obj2.x);
System. out. println(obj2.y);
[填空题]下列程序输出结果为:
#include<iostream>
using namespace std;
class TestClass1
{
public:
TestClass1( ){}
TestClass1(int i)
{
x1=i;
}
void dispa( )
{
cout<<"x1="<<x1<<",";
}
private:
int x1;
};
class TestClass2:public TestClass1
{
public:
TestClass2( ){}
TestClass2(int i):TestClass1(i+10)
{
x2=i;
}
void dispb( )
{
dispa( );
cout<<"x2="<<x2<<endl;
}
private:
int x2;
};
int main( )
{
TestClass2 b(2);
b.dispb( );
return 0;
}
[单项选择]下列程序输出结果为( )。
public class test
public static void main(String args[])
int a=0;
outer: for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
if(j>i)
continue outer;
a++;
System. out. println(a);
A. 0
B. 2
C. 3
D. 4
[单项选择]以下程序输出结果为( )。
class test 2
public static void main(String args[])
int n = 7;
n<<=3;
n=n&n+1|1n+2^n+3;
n>>=2;
System.out.println(n);
A. 0
B. -1
C. 14
D. 64
[填空题]下列程序输出结果为 【15】 。
public class test
public static void main(String args[])
int a=0;
outer: for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
if(j>i)
continue outer;
a++;
System. out. println(a);
[填空题]下列程序输出结果为:
#include<iostream>
using namespace std;
class TestClass1
public:
TestClass1( )
TestClass1(int i)
x1=i;
void dispa( )
cout<<"x1="<<x1<<",";
private:
int x1;
;
class TestClass2:public TestClass1
public:
TestClass2( )
TestClass2(int i):TestClass1(i+10)
x2=i;
void dispb( )
dispa( );
cout<<"x2="<<x2<<endl;
private:
int x2;
;
int main( )
TestClass2 b(2);
b.dispb( );
return 0;
[单项选择]下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }
A. 0
B. 2
C. 3
D. 4