AP计算机科学A课程真题

标签:
ap计算机ap计算机科学a课程2015年真题学习资料 |
Consider the following incomplete method, which is intended to
return the number of integers that evenly divide the
integer inputVal
. Assume
that inputVal
- public static int numDivisors(int inputVal)
- {
- int count = 0;
- for (int k = 1; k <=inputVal; k++)
- {
- if ( )
- {
- count++;
- }
- }
- return count;
- }
Which of the following can be used to replace so
that numDivisors
Consider the following code segment.
- for (int r = 3; r > 0; r--)
- {
- int c;
- for (c = 1; c < r; c++)
- {
- System.out.print("-");
- }
- for (c = r; c <= 3; c++)
- {
- System.out.print("*");
- }
- System.out.println();
- }
What is printed as a result of executing the code
segment?
Consider the following two classes.
- public class A
- {
- public void show()
- {
- System.out.print("A");
- }
- }
- public class B extends A
- {
- public void show()
- {
- System.out.print("B");
- }
- }
What is printed as a result of executing the following code segment?
- A obj = new B();
- obj.show();
Consider the following method, biggest
, which is intended to return the
greatest of three integers. It does not always work as
intended.
- public static int biggest(int a, int b, int c)
- {
- if ((a > b) && (a > c))
- {
- return a;
- }
- else if ((b > a) && (b > c))
- {
- return b;
- }
- else
- {
- return c;
- }
- }
Which of the following best describes the error in the method?
Consider the following method.
- public static void showMe(int arg)
- {
- if (arg <</span> 10)
- {
- showMe(arg+1);
- }
- else
- {
- System.out.print(arg + " ");
- }
- }
What will be printed as a result of the
call showMe(0)
?
Consider the following sort
data
into increasing order.
- public static void sort(int[] data)
- {
- for ( int j = 0; j < data.length - 1; j++)
- {
- int m = j;
- for (int k = j + 1; k < data.length; k++)
- {
- if (data[k] < data [m])
- {
- m = k;
- }
- }
- int temp = data[m];
- data[m] = data[j];
- data[j] = temp;
- }
-
AP 计算机 一次完美的逆袭-----深圳中学陈南泽谈AP计算机的学习
AP计算机满分经验分享,人生应当有双桨----重庆巴蜀中学陈恒至谈AP计算机课程学习wechat:APFlying
他山之石,可以攻玉----AP计算机满分经验分享wechat:APFlying
AP 计算机 满分经验谈------北京二十一世纪学生谈AP计算机课程满分经验谈
http://s6/mw690/001jUFkKzy7nR2H0Jx3e5&690
http://s2/mw690/001jUFkKzy7nR2H5lYdf1&690
http://s1/mw690/001jUFkKzy7nR2H8HVm80&690
http://s11/mw690/001jUFkKzy7nR2HdNqO0a&690
http://s4/mw690/001jUFkKzy7nR2HjXV153&690
http://s7/mw690/001jUFkKzy7nR2HhHUif6&690
http://s16/mw690/001jUFkKzy7nR2Hs09Naf&690
http://s2/mw690/001jUFkKzy7nR2HvNHr81&690
http://s8/mw690/001jUFkKzy7nR2HAs4La7&690
http://s4/mw690/001jUFkKzy7nR2HDvpxa3&690
http://s11/mw690/001jUFkKzy7nR2HIdrsaa&690
http://s8/mw690/001jUFkKzy7nR2HLBJ537&690
http://s12/mw690/001jUFkKzy7nR2J3MjFbb&690