网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
1. interface DoStuff2 { 2. float getRange(int low, int high); } 3. 4. interface DoMore { 5. float getAvg(int a, int b, int c); } 6. 7. abstract class DoAbstract implements DoStuff2, DoMore { } 8. 9. class DoStuff implements DoStuff2 { 10. public float getRange(int x, int y) { return 3.14f; } } 11. 12. interface DoAll extends DoMore { 13. float getAvg(int a, int b, int c, int d); } What is the result?()
A
The file will compile without error.
B
Compilation fails. Only line 7 contains an error.
C
Compilation fails. Only line 12 contains an error.
D
Compilation fails. Only line 13 contains an error.
E
Compilation fails. Only lines 7 and 12 contain errors.
F
Compilation fails. Only lines 7 and 13 contain errors.
G
Compilation fails. Lines 7, 12, and 13 contain errors.
参考答案
参考解析
解析:
暂无解析
更多 “单选题1. interface DoStuff2 { 2. float getRange(int low, int high); } 3. 4. interface DoMore { 5. float getAvg(int a, int b, int c); } 6. 7. abstract class DoAbstract implements DoStuff2, DoMore { } 8. 9. class DoStuff implements DoStuff2 { 10. public float getRange(int x, int y) { return 3.14f; } } 11. 12. interface DoAll extends DoMore { 13. float getAvg(int a, int b, int c, int d); } What is the result?()A The file will compile without error.B Compilation fails. Only line 7 contains an error.C Compilation fails. Only line 12 contains an error.D Compilation fails. Only line 13 contains an error.E Compilation fails. Only lines 7 and 12 contain errors.F Compilation fails. Only lines 7 and 13 contain errors.G Compilation fails. Lines 7, 12, and 13 contain errors.” 相关考题
考题
在C++语言中,若类C中定义了一个方法int f(int a,int b),那么方法___(33)___不能与该方法同时存在于类C中。(33)A.int f(int x,int y) B.int f(float a,int b)C.float f(int x,float y) D.int f(int x,float y)
考题
若各选项中所用变量已正确定义,函数 fun 中通过 return 语句返回一个函数值,以下选项中错误的程序是A)main(){ …… x=fun(2,10); …… }float fun(int a,int b){ …… }B)float fun(int a,int b){ …… }main(){ …… x=fun(i,j); …… }C)float fun(int,int);main(){ …… x=fun(2,10); …… }float fun(int a,int b) { …… }D)main(){ float fun(int i,int j);…… x=fun(i,j); …… }float fun(int a,int b){ …… }
考题
下列程序段不会发生二义性的是_。
A.int fun(double p){…;} float fun(float p){…;} int x; x=fun(0);B.int fun(float p){…;}float fun(unsigned p){…;} int x; x=fun(0);C.int fun(int i,int j=2){…;}float fun(int i){…;} coutfun(5);D.int fun(int i=2,int j=2){…;} int fun(int *p){…;} coutfun(5);
考题
●试题三阅读下列函数说明和C代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】函数move(int*a,int n)用于整理数组a[]的前n个元素,使其中小于0的元素移到数组的前端,大于0的元素移到数组的后端,等于0的元素留在数表中间。令a[0]~a[low-1]小于0(初始为空);a[low]~a[i-1]等于0(初始为空);a[i]~a[high]还未考察,当前考察元素为a[i]。a[high+1]~a[n-1]大于0(初始为空)。【函数】move(int*a,int n){int i,low,high,t;low=i=0;high=n-1;while( (1) )if(a[i]0){t=a[i];a[i]=a[low];a[low]=t;(2) ;i++;}else if( (3) ){t=a[i];a[i]=a[high];a[high]=t;(4) ;}else (5) ;}
考题
在C++语言中,若类C中定义了一个方法int f(int a,int b),那么方法(33)不能与该方法同时存在于类C中。A.int f(int x,int y)B.int f(float a,int b)C.float f(mtx,float y)D.int f(int x,float y)
考题
若各选项中所用变量已正确定义,fun()函数中通过return语句返回一个函数值,下列选项中错误的程序是( )。A.main() {……x=fun(2,10);……} float fun(int a,int b){……}B.float fun(int a,int b){……} main() {……x=fun(i,j);……}C.float fun(int,int); main() {……x=fun(2,10);……} float fun(int a,int b){……}D.main() {float fun(int I,intj); ……x=fun(i,j);……} float fun(int a,int b){……}
考题
类Test定义如下,将下列______方法插入③行处是不合法的。 ( )①public class Test{②public float Method(float a,float b){}③④}A.public float Method(float a,float b,float c){}B.public float Method(float c,float d){}C.public int Method(int a,int b){}D.private float Method(int a,int b,int c){}
考题
在C++语言中,若类C中定义了一个方法int (int a,int b),那么方法(1)不能与该方法同时存在于类C中。A.int f(int x,int y)B.int f(float a,int b)C.float f(int x,float y)D.int f(int x,float y)
考题
类testl定义如下: public class test1 { public float amethod(float a,float b){ } }A.public foat amethod(float a,float b,foat c){ }B.public float amethod(float c,float d){ }C.public int amethod(int a,int b){ }D.private float amethod(int a,int b,int c){ }
考题
类Test定义如下,将下列哪个方法插入③行处是不合法的( )?① public class Test{② public float Method(float a,float B) { }③ ______④ }A.public float Method(float a,float b,float C) { }B.public float Method(float c,float d){ }C.public int Method(int a,int B) { }private float Method(int a,int b,int C) { }D.private float Method(int a,int b,int C) { }
考题
下列重载函数中,正确的是( )。A.void fun(int a,float b);void fun(int C,float d)B.void fun(int a,float b);void fun(float a,int b)C.float fun(int a,float b);int fun(int b,float a)D.int fun(int a,int b);float fun(int a,int b)
考题
阅读以下说明和代码,填补代码中的空缺,将解答填入答题纸的对应栏内。【说明】下面的程序利用快速排序中划分的思想在整数序列中找出第 k 小的元素(即 将元素从小到大排序后,取第 k 个元素)。对一个整数序列进行快速排序的方法是:在待排序的整数序列中取第一个数 作为基准值,然后根据基准值进行划分,从而将待排序的序列划分为不大于基准 值者(称为左子序列)和大于基准值者(称为右子序列),然后再对左子序列和 右子序列分别进行快速排序,最终得到非递减的有序序列。例如,整数序列“19, 12, 30, 11,7,53, 78, 25"的第 3 小元素为 12。整数序列“19, 12,7,30, 11, 11,7,53. 78, 25, 7"的第 3 小元素为 7。函数 partition(int a[], int low,int high)以 a[low]的值为基准,对 a[low]、 a[low+l]、…、a[high]进行划分,最后将该基准值放入 a[i] (low≤i≤high),并 使得 a[low]、a[low+l]、,..、A[i-1]都小于或等于 a[i],而 a[i+l]、a[i+2]、..、 a[high]都大于 a[i]。函 教 findkthElem(int a[],int startIdx,int endIdx,inr k) 在 a[startIdx] 、 a[startIdx+1]、...、a[endIdx]中找出第 k 小的元素。【代码】#include #include
Int partition(int a [],int low, int high){//对 a[low..high]进行划分,使得 a[low..i]中的元素都不大于 a[i+1..high]中的 元素。int pivot=a[low]; //pivot 表示基准元素 Int i=low,j=high;while(( 1) ){While(ipivot)--j; a[i]=a[ j] While(ipivot)++i; a[ j]=a[i]}(2) ; //基准元素定位 return i;}Int findkthElem(int a[],int startIdx,int endIdx, int k){//整数序列存储在 a[startldx..endldx]中,查找并返回第 k 小的元素。if (startldxendIdx || kendIdx||k-1 if (loc==k-1) ∥找到第 k 小的元素return (3) ;if(k-l 小的元素}return 0;}
考题
interface Altitude { //insert code here } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?() A、 0B、 1C、 2D、 3E、 4
考题
public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?()A、 Private void setVar (int a, float c, int b) {}B、 Protected void setVar (int a, int b, float c) {}C、 Public int setVar (int a, float c, int b) (return a;)D、 Public int setVar (int a, int b, float c) (return a;)E、 Protected float setVar (int a, int b, float c) (return c;)
考题
下面的方法重载,正确的是()。A、int fun(int a, float b) { } float fun(int a, float b) { }B、float fun(int a, float b) { } float fun(int x, float y) { }C、float fun(float a) { } float fun(float a, float b) { }D、float fun1(int a, float b) { } float fun2(int a, float b) { }
考题
在C语言中(以16为PC机为例),5种基本数据类型的存储空间长度的排列顺序为()。A、char int long int = float doubleB、char = int long int = float doubleC、char int long int = float = doubleD、char = int = long int = float double
考题
Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2?()A、 final int k = 4:B、 public int k = 4:C、 static int k = 4:D、 private int k = 4:E、 abstract int k = 4:F、 volatile int k = 4:G、 transient int k = 4:H、 protected int k = 4:
考题
现有: 1. interface Altitude { 2. //insert code here 3. } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?() A、 0B、 1C、 2D、 3E、 4
考题
单选题下列重载函数中,正确的是( )。A
void fun(int a,float b);void fun(int C,float d)B
void fun(int a,float b);void fun(float a,int b)C
float fun(int a,float b);int fun(int b,float a)D
int fun(int a,int b);float fun(int a,int b)
考题
单选题interface Altitude { //insert code here } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?()A
0B
1C
2D
3E
4
考题
多选题Given: 1. public class Method Over { 2. public void set Var (int a, int b, float c) { 3. } 4. } Which two overload the set Var method()?Aprivate void set Var(int a, float c, int b) {}Bprotected void set Var(int a, int b, float c) {}Cpublic int set Var(int a, float c, int b) {return a:}Dpublic int set Var(int a, int b, float c) {return a:}Eprotected float set Var(int a, int b, float c) {return c:}
考题
单选题类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()A
public float aMethod(float a, float b,float c){ return 0;}B
public float aMethod(float c,float d){ return 0;}C
public int aMethod(int a, int b){ return 0;}D
private float aMethod(int a,int b,int c){ return 0;}
考题
多选题public class MethodOver { private int x, y; private float z; public void setVar(int a, int b, float c){ x = a; y = b; z = c; } } Which two overload the setVar method?()Avoid setVar (int a, int b, float c){ x = a; y = b; z = c; }Bpublic void setVar(int a, float c, int b) { setVar(a, b, c); }Cpublic void setVar(int a, float c, int b) { this(a, b, c); }Dpublic void setVar(int a, float b){ x = a; z = b; }Epublic void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }
考题
多选题Given: 1. public interface Foo { 2. int k = 4: 3. } Which three are equivalent to line 2?()Afinal int k = 4:Bpublic int k = 4:Cstatic int k = 4:Dprivate int k = 4:Eabstract int k = 4:Fvolatile int k = 4:Gtransient int k = 4:Hprotected int k = 4:
考题
多选题public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?()APrivate void setVar (int a, float c, int b) {}BProtected void setVar (int a, int b, float c) {}CPublic int setVar (int a, float c, int b) (return a;)DPublic int setVar (int a, int b, float c) (return a;)EProtected float setVar (int a, int b, float c) (return c;)
考题
单选题现有: 1. interface Altitude { 2. //insert code here 3. } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?()A
0B
1C
2D
3E
4
考题
单选题下面的方法重载,正确的是()。A
int fun(int a, float b) { } float fun(int a, float b) { }B
float fun(int a, float b) { } float fun(int x, float y) { }C
float fun(float a) { } float fun(float a, float b) { }D
float fun1(int a, float b) { } float fun2(int a, float b) { }
热门标签
最新试卷
![瑞牛题库 章节练习 历年真题 模拟试卷](http://assets.51tk.com/51_sidebar_right_index.jpg)