已知集合P={x|0 ≤x ≤5,x∈Z},Q={y|y=|x2-1|,x∈P},则P∩Q中元素的个数是( ).
(A)3.
(B)6.
(C)8.
(D)9.
第1题:
以下4个程序中,不能实现两个实参值进行交换的是 ( )。
A.void swap (float *p, float *q) { float *t ,a; t = &a; t = p; *p = *q; *q = *t; } void main () { float x = 8.0;y = 9.0; swap (&x, &y); cout<<x<<", "<<y<<
B.void swap (float *p, float *q) { float a; a = *p; *p = *q; *q = a; } void main() { float x = 8.0;y = 9.0; swap (&x, &y); cout<<x<<", "<<y<<end1;
C.void swap (float *p, float *q) { float x; x = *p; *p = *q; *q = x; } void main() { float a,b.; *a = 8.0;*b = 9.0; swap (a, b) ;
D.void swap (float &p, float &q) { float a; a = p; p = q; q = a; } void main() { float a = 8.0,b = 9.0; swap (a,b); cout<<x<<", "<<y<<
第2题:
设有关键码序列(Q,C,M,Z,A,N,B,P,X,H,Y,S,T,L,K,E),采用二路归并排序法进行排序,下面哪—个序列是第二趟归并后的结果?
A.C,Q,M,Z,A,N,B,P,H,X,S,Y,L,T,E,K
B.C,M,Q,Z,A,B,N,P,H,S,X,Y,E,K,L,T
C.C,M,Q,A,N,B,P,X,H,Y,S,T,L,K,E,Z
D.A,B,C,M,N,P,Q,Z,E,H,K,L,S,T,X,Y
第3题:
设有关键码序为(Q,G,M,Z,A,N,B,P,X,H,Y,S,T,L,K,E),采用二路归并排序法进行排序,下面哪一个序列是第二趟归并后的结果?
A.G,Q,M,Z,A,N,B,P,H,X,S,Y,L,T,E,K
B.G,M,Q,Z,A,B,N,P,H,S,X,Y,E,K,L,T
C.G,M,Q,A,N,B,P,X,H,Y,S,T,L,K,E,Z
D.A,B,G,M,N,P,Q,Z,E,H,K,L,S,T,X,Y
第4题:
第5题:
第6题:
以下程序的输出结果是include "stdio.h"int *f(int *x,int *y){ if(*x<*y) return x; else return y;}main(){ int a=7,b=8, *p,*q,*r ; p=&a; q=&b; r= f(p,q); printf("%d,%d,%d\n",*p,*q,*r);}
第7题:
有以下程序: #include <iostream> #include <cmath> using namespace std; class Distance; class point { public: friend class Distance; Point(int a,int B) { x=a; Y=b; } void Print() { cout<<"X= "<<X<<end1; cout<<"Y= "<<Y<<end1; } private: float X,Y; }; class Distance { public: float Dis(Point &p,Point &q); }; float Distance :: Dis(Point &p,Point &q) { float result; result=sqrt((p.X-q.X)*(p.X-q.X)+(p.Y-q.Y)*(p.Y-q.Y)); cout<<result<<end1; retUrn result; } int main() { Point p(10,10),q(10,30); Distance d; d.Dis(p,q); return 0; } 运行后的输出结果是( )。
A.10
B.30
C.0
D.20
第8题:
设有关键码序列(Q, G, M, Z, A, N, B, P, X, H, Y, S, T, L, K, E),采用二路归并排序法进行排序,下面哪一个序列是第二趟归并后的结果?( )
A) G, Q, M, Z, A, N, B, P, H, X, S, Y, L, T, B, K
B) G, M, Q, Z, A, B, N, P, H, S, X, Y, E, K, L, T
C) G, M, Q, A, N, B, P, X, H, Y, S, T, L, K, E, Z
D) A, B, G, M, N, P, Q, Z, E, H, K, L, S, T, X, Y
A.
B.
C.
D.
第9题:
第10题: