Download test here

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
COURSE NAME: ICS3U COMPUTER SCIENCE
Test2 Programming Concepts and Skills
Time:
Categories
3
hours
9
Pages
Knowledge and
Understanding
Symbol
K/U
Weight
25
Student:
Date:
Thinking, Inquiry,
Problem Solving
T/I
%
25
%
Teacher: Paul Pu
11/22/2016
Communication
C
25
Application
A
%
25%
Level
Specific Curriculum Expectations
A1.3 use assignment statements correctly with both arithmetic and string expressions in computer programs;
A1.4 demonstrate the ability to use Boolean operators (e.g., AND, OR, NOT), comparison operators (i.e., equal to,
not equal to, greater than, less than, greater than or equal to, less than or equal to), arithmetic operators
(e.g.,addition, subtraction, multiplication, division, exponentiation, parentheses), and order of operations correctly
in computer programs;
A1.5 describe the structure of one-dimensional arrays and related concepts, including elements, indexes, and
bounds;
A1.6 write programs that declare, initialize, modify, and access one-dimensional arrays.
A2.1 write programs that incorporate user input, processing, and screen output;
A2.2 use sequence, selection, and repetition control structures to create programming solutions;
A2.3 write algorithms with nested structures (e.g., to count elements in an array, calculate a total, find highest or
lowest value, or perform a linear search).
Evaluation Rubric:
Category
Level 1
Level 2
Level 3
Level 4
Knowledge
demonstrates limited
understanding of
algorithms with
nested structures
demonstrates some
understanding of
algorithms with
nested structures
demonstrates
considerable
understanding of
algorithms with
nested structures
demonstrates
thorough
understanding of
algorithms with
nested structures
identifying and
correcting limited
errors
identifying and
correcting a few
errors
identifying and
correcting some
errors
identifying and
correcting most
errors
– Understanding of
algorithms with
nested structures
Thinking/ Inquiry
– Understanding of
content and
Identifying code
errors (e.g. variables,
decisions, loops,
arrays, input/output,
nested structures)
Communication
- Steps clearly
explained
(algorithms)
limited to no
explanation as to
search algorithms
- some explanation as
to search algorithms
- good explanation as
to search algorithms
- excellent
explanation as to
search algorithms
applies search
algorithms with
limited effectiveness
applies search
algorithms with
some effectiveness
applies search
algorithms with
considerable
effectiveness.
applies search
algorithms with a
high degree of
effectiveness
program crashes or
does not function at
all
program has minimal
functionality
program vary rarely
crashes and functions
well
program functions
smoothly with all
crashing issues
addressed
Application
– Application of
knowledge and skills
(search algorithms)
– program
functionality
Part A: Short Answer (Knowledge & Understanding) (25%)
1.
Illustrate the output for the following program; figure it out by hand
Question
Answer
System.out.println(“I Love Java”);
System.out.println(500);
System.out.println(“6” +( 6 + 6));
System.out.println(6 + 6 + “6”);
System.out.println("3*2="+ 3 * 2);
2.Trace through the following code segments and illustrate the output and memory.
Memory
int a = 1;
int b = 2;
System.out.println(b);
a = b + 4;
a = a + b;
System.out.println(b+6);
System.out.println(a);
int ans = 5;
int res = 5;
int num;
num=ans + res;
System.out.println(num + 2);
res=num --;
System.out.println( res);
Output
int a, b, c;
double d, e, f;
a = 6;
b = 2;
d = a;
c = a / b;
e = a / b;
f = e / b;
a = a + 3 * b;
d = b – d * 4;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
3.Trace the following program fragments:
Program
int i = 15;
while (i > 5)
{
i= i - 3;
System.out.println (i);
}
Memory
Output
int x = 21;
int y = 10;
do
{
System.out.println(x);
x = x - 4;
} while (x > y);
int x = 3;
int y = 18;
do
{
x = x + 3;
y = y - 1;
System.out.println (x);
} while (x <y);
4.Trace the following program fragments:
Program
Memory
for (int i = 1; i <= 6; i++)
{
System.out.println(“I love Java”);
}
System.out.println(“Good-bye”);
Output
for (int count = -5; count <= 1; count = count + 2)
{
System.out.println(count*2);
}
for (int i = 9; i > 2; i = i – 1)
{
System.out.println(i + 5);
}
int first,second;
Input: 3,8
System.out.print(“Enter starting value: “);
first = sc.nextInt( );
System.out.print(“Enter ending value: “);
second = sc.nextInt( );
for (int i = first; i <= second; i++)
{
System.out.println(i );
System.out.println(“*”);
}
Input: 9, 6
Part B Program analyzing (Thinking & Inquiry) (25%)
1. Fix the following Java Code Snippet if there are errors.
{
System.out.println(I Love Java);
}
2. Fix the following Java Code Snippet if there are errors.
for ( count = -5; count <= 1; count = count + 2)
{
System.out.println(“Hello”);
}
3. Fix the following Java Code Snippet if there are errors.
{
double a=10.5;
A=99;
B=a+7;
}
}
4. Fix the following Java Code Snippet if there are errors.
public static void main(String args){
System.out.println(args[0]+args[1]);
}
5. Fix the following Java Code Snippet if there are errors.
{
int car=new int[5];
}
}
6. Avarage.java: Write a program to read in a series of make of 8 students and output the average mark in
students
7. WhoIam.java Write a program that asks the user to enter his/her name and output a statement telling him/her
the name.
-- > java WhoIam
What’s your name? Kathy
So you are: Kathy
Part C. Application Analysis (Communication) 25%
Write a java program: MinValue.java. Print out the Min value of an array.
For example:
input>java MinValue 8 6 3 10 2 5 6 7 9
Output> Min value of this array is:2
Teacher will interview you to check your understanding of Search algorithm and evaluate your Communication
skills. Be prepared to explain your codes to your teacher.
Part D: Full solutions/Case studies (Application) 25%
Write a java program: Search.java to search a text in a list. The last argument parameter is the search text.
The below example: Search “object” in “Java is an object oriented language” list.
For Example:
----> java Search Java is an object oriented language object
Output> object is in the location 4