PART A (MUTIPLE CHOICE 7 marks)
1. What is the result of evaluating the following expression? (1/2 + 3.5) *2.0
a) 8.0
b) 8
c) 7.0
d) 0
2. What assignment is correct
a) char aChar=5;
b) char aChar =”w”;
c) char aChar =’*’;
d) a and c are correct
3. Here is part of a graphics program that simulates a color fading in the sun. The amount of red starts at the maximum of 1.0 and is faded by decreasing it by 1% each time the loop executes, until it is close to zero.
double redLevel=1.0;
while (__________________________)
{
redLevel = redLevel*0.99;
//the new redLevel is used here in some graphics methods
}
Pick a condition for the while statement
a) redLevel=0.0
b) redLevel >0.001
c) Math.abs(redLevel) <0.0
b) classB(X.computeSum());
c) X.computeSum();
d) You cannot call computeSum(); from with classB
PART B (SHORT ANSWER 79 MARKS)
1. What is a class? (2 marks)
2. Describe in detail the difference between a procedure type method and a function type method. (4 marks)
4. Correct the errors in the following C# code. (5 marks)
private check ( userpassword, realpassword)
{
if (userpassword = realpassword)
{
check “found”;
}
else
{
check “not found”;
}
}
Note: this is supposed to be a function type method
6. Provide a tolerance expression for each of the following problems
a) Given a triangle with sides a,b, and c . Determine if the triangle is right angled. Hint: Remember Pythagoras? (3 marks)
7. Assume we have the following situation (3 marks)
Name[1]=”Tom”
Name[2]=”John”
Name[3]=”Frank”
Name[4]=”Sam”
Name[5]=”Pete”
Provide a simple loop which will delete “John” from the list
12. Design a method that will determine whether a number passed to it is even or odd. Eg. EvenOdd(15) should return the word ‘odd’ (3 marks)
13. What is the purpose of overloading methods (2 marks)
15. Provide the missing code below which uses pointer sorting (5 marks)
private void ExchangeSort()
{
string tempn = "";
string tempc = "";
int temph;
for (int j = 1; j <= n - 1; j++)
{
for (int k = j + 1; k <= n; k++)
{
if (homeruns[j] < homeruns[k])
{
tempn = names[j];
names[j] = names[k];
names[k] = tempn;
tempc = cities[j];
cities[j] = cities[k];
cities[k] = tempc;
temph = homeruns[j];
homeruns[j] = homeruns[k];
homeruns[k] = temph;
}
}
}
}
private void PointerExchangeSort()
{
int temp;
for (int i = 1; i <= n; i++)
pointers[i] = ;
something missing here
for (int j = 1; j <= n - 1; j++)
{
for (int k = j + 1; k <= n; k++)
{
provide missing code
}
}
}
17. In the code below what would cause C# to catch a FormatException (2 marks)
private void divideButton_Click(object sender, EventArgs e)
{
string result = "";
try
{
double dividend = Double.Parse(dividendBox.Text);
double divisor = Double.Parse(divisorBox.Text);
result = (dividend / divisor).ToString();
}
//catching specific types of exceptions
catch (FormatException)
{
MessageBox.Show(" ");
}
} what would cause this error
you fill in the appropriate comment
PART C (PROGRAMMING 85 MARKS)
Problem 2 (45 marks)
The table below represents the quantities on hand at various warehouses of various items sold . Assume a data file already exists named "WarehouseData.Txt" which contains all the quantity numbers ,item names and warehouse names. The last two columns Cost Price and Sell Price are also in the data file (just the numbers ). Code one or more C# statements to perform the following operations on the data:
Warehouses A B C D E
shovels
hammers
rakes
picks
barrels
1. Load all the arrays with the appropriate data (5 marks)
a) Load the quantity numbers into a 2-d array called quantity
b) Load the items and warehouse names into 1-d arrays called item and warehouse
c) Load the cost and selling prices into 1-d arrays called cost and sell
2. Print out the table (don't include the cost price or selling price) (5 marks)
3. Printout a list of items and warehouse locations where the quantity on hand is less than 10
(5 marks)
PART D (FLASH ACTIONSCRIPTING 9 MARKS)
Below is the screen shot of a simple Flash Game
What follows on the next page is PART of the actionscript to play the game. You are to complete the required code so that the duck chases the butterfly and when it collides the hitcount is updated. The movie clip names of the objects are written on screen for your information.
Thursday, May 28, 2009
Monday, May 11, 2009
ICS3M Final Projects and Exams Coming Up !!!
Make sure to check First Class for specifics on our upcoming final assignments . Our final exam in this course will be held on Friday May 22. Below our some Exam hints.
PART A : MULTIPLE CHOICE (7 marks)
1. Which key moves the focus from one control to another
a) Alt
b) Enter
c) Esc
d) Shift
e) Tab
2. If you want to include more than one group of Radio buttons in a form, you need to put each group into
a) a separate form
b) a separate frame control
c) a separate group control
d) a separate option group
e) you can’t have more than one group of option buttons on a form
3. Which assignment statement tells C# to multiply the contents of the LblRate control by the contents of the TxtHours control and place the product in a control called LblPay.
a) LblPay.Caption=LblRate.Text * val(TxtHours.text)
b) LblPay.Text=val(LblRate.Text)*Convert.ToInt32(TxtHours.Caption)
c) val(LblPay.Text)=val(LblRate.Text)*val(TxtHours.Caption)
d) Convert.ToInt32(LblPay.Caption)=LblRate.Caption*TxtHours.Text
e) LblPay.Text=Convert.ToInt32(LblRate.Text)*int.Parse(TxtHours.Text)
4. This property contains a number that represents the current location of the scroll bar in the Horizontal scroll control.
a) BoxLoc
b) BoxVal
c) ScrollLoc
d) ScrollVal
e) Value
PART B : FILL IN THE BLANKS (9 marks)
1. The characteristics that control an objects appearance and behavior are called
_________________________
2. When you save a form C# adds the extension ______ to the name.
3. (double) (5/2) equals _________
4. The ___________ property tells a label control to automatically adjust to the size of the caption.
5. When the program below is executed the value of x will be __________
int [] n = new int[11];
for (int s = 1;s<=10;s++)
{
n[s] = s+3;
}
x = n[3] + n[8] – n[10];
PART C : SHORT ANSWER
1. Describe the difference between the two main types of methods (3 marks)
2. Describe the purpose of each of the following flow chart symbols (3 marks)
Symbol
Purpose
PART D : PROGRAMMING PROBLEMS
1. Speeding fines are determined as follows
Amount over Speed Limit Fine
1-10 Km/Hr $5
11-20 $15
21-30 $25
over 30 Jail
Write a program which repeatedly accepts the amount over the speed limit and determines the appropriate fine. Accept only valid entries and ask the user if they wish to quit. (10 marks)
3. The table below represents sales (in dollars) made by salespeople over a one week period. Assume a data file already exists named "SalesData.txt" which contains all the numbers, names and days of the week. Code one or more C# statements to perform the following operations on the data:
a) Declare and Load the data into a 2-d array called Sales (3 marks)
b) Declare and Load all the names and days of the week into 1-d arrays called names and days (2 marks)
c) Display the complete table (5 marks)
d) Determine the weekly sales totals for each salesperson. Make sure you store each total in a one dimensional array called WeeklySales (5 marks)
PART A : MULTIPLE CHOICE (7 marks)
1. Which key moves the focus from one control to another
a) Alt
b) Enter
c) Esc
d) Shift
e) Tab
2. If you want to include more than one group of Radio buttons in a form, you need to put each group into
a) a separate form
b) a separate frame control
c) a separate group control
d) a separate option group
e) you can’t have more than one group of option buttons on a form
3. Which assignment statement tells C# to multiply the contents of the LblRate control by the contents of the TxtHours control and place the product in a control called LblPay.
a) LblPay.Caption=LblRate.Text * val(TxtHours.text)
b) LblPay.Text=val(LblRate.Text)*Convert.ToInt32(TxtHours.Caption)
c) val(LblPay.Text)=val(LblRate.Text)*val(TxtHours.Caption)
d) Convert.ToInt32(LblPay.Caption)=LblRate.Caption*TxtHours.Text
e) LblPay.Text=Convert.ToInt32(LblRate.Text)*int.Parse(TxtHours.Text)
4. This property contains a number that represents the current location of the scroll bar in the Horizontal scroll control.
a) BoxLoc
b) BoxVal
c) ScrollLoc
d) ScrollVal
e) Value
PART B : FILL IN THE BLANKS (9 marks)
1. The characteristics that control an objects appearance and behavior are called
_________________________
2. When you save a form C# adds the extension ______ to the name.
3. (double) (5/2) equals _________
4. The ___________ property tells a label control to automatically adjust to the size of the caption.
5. When the program below is executed the value of x will be __________
int [] n = new int[11];
for (int s = 1;s<=10;s++)
{
n[s] = s+3;
}
x = n[3] + n[8] – n[10];
PART C : SHORT ANSWER
1. Describe the difference between the two main types of methods (3 marks)
2. Describe the purpose of each of the following flow chart symbols (3 marks)
Symbol
Purpose
PART D : PROGRAMMING PROBLEMS
1. Speeding fines are determined as follows
Amount over Speed Limit Fine
1-10 Km/Hr $5
11-20 $15
21-30 $25
over 30 Jail
Write a program which repeatedly accepts the amount over the speed limit and determines the appropriate fine. Accept only valid entries and ask the user if they wish to quit. (10 marks)
3. The table below represents sales (in dollars) made by salespeople over a one week period. Assume a data file already exists named "SalesData.txt" which contains all the numbers, names and days of the week. Code one or more C# statements to perform the following operations on the data:
a) Declare and Load the data into a 2-d array called Sales (3 marks)
b) Declare and Load all the names and days of the week into 1-d arrays called names and days (2 marks)
c) Display the complete table (5 marks)
d) Determine the weekly sales totals for each salesperson. Make sure you store each total in a one dimensional array called WeeklySales (5 marks)
Wednesday, March 25, 2009
Welcome Back From March Break
Welcome back !!!
I hope you had a great break. Please check First Class for detailed news of all your upcoming tests and assignments. Remember, midterm is coming up, so notebooks and blogs will be due. These are easy communication marks to get. No lates are accepted.
Take care
Mr. Chiarelli
I hope you had a great break. Please check First Class for detailed news of all your upcoming tests and assignments. Remember, midterm is coming up, so notebooks and blogs will be due. These are easy communication marks to get. No lates are accepted.
Take care
Mr. Chiarelli
Friday, January 30, 2009
BTA301 Test Hints
COMPUTER LITERACY QUIZ
________________ are used to enter data into the computer so it can be processed. ________________ are used to get it out so we can see it or distribute it to others.
All scanners and digital cameras capture images with a ___________ device.
Fonts are categorized by their __________, ___________ and size.
The range of colors (called color depth) available in a scanner, printer or display is determined by how many _________ are used to store data for each pixel.
Optical storage devices use a ____________ to burn small dark pits into the surface of a disc.
Data on a tape can be accessed _______________ while that on a disk can be accessed _______________.
For data to be stored on a disk or tape, the medium must first be _____________.
The DVD disc you can write on many times is called ______________.
System software included __________________ and ______________________.
On Windows systems, ____________________ allow programs to identify which applications created which files.
The path to a file named January in a folder named budgets on the d: drive is ____________________
_______________________ means the computer can run more than one program at the same time.
When two or more computers are connected together so they can communicate with one another, they are said to form a _____________________.
The language used for creating Web pages is called ___________________.
Browsers are enhanced by installing _____________________.
An email address has two parts: the __________________ and ________________ separated by an "at" sign (@).
Mass unwanted e-mailings are called ______________.
On an ______________________ network all nodes listen to the traffic on the network and try to send data only when it’s quiet.
Software that has no restrictions regarding its use is called ______________________.
To keep related files together you should store them in a ________________.
Web addresses are called _____________.
Search engines search indexes of key terms that are often compiled by a software program called a __________________.
When you transfer a file from another computer to your own , it’s called ___________________.
__________________ files contain only text, use only a limited set of characters, and have almost no formatting so they are easy to transfer.
________________ are used to enter data into the computer so it can be processed. ________________ are used to get it out so we can see it or distribute it to others.
All scanners and digital cameras capture images with a ___________ device.
Fonts are categorized by their __________, ___________ and size.
The range of colors (called color depth) available in a scanner, printer or display is determined by how many _________ are used to store data for each pixel.
Optical storage devices use a ____________ to burn small dark pits into the surface of a disc.
Data on a tape can be accessed _______________ while that on a disk can be accessed _______________.
For data to be stored on a disk or tape, the medium must first be _____________.
The DVD disc you can write on many times is called ______________.
System software included __________________ and ______________________.
On Windows systems, ____________________ allow programs to identify which applications created which files.
The path to a file named January in a folder named budgets on the d: drive is ____________________
_______________________ means the computer can run more than one program at the same time.
When two or more computers are connected together so they can communicate with one another, they are said to form a _____________________.
The language used for creating Web pages is called ___________________.
Browsers are enhanced by installing _____________________.
An email address has two parts: the __________________ and ________________ separated by an "at" sign (@).
Mass unwanted e-mailings are called ______________.
On an ______________________ network all nodes listen to the traffic on the network and try to send data only when it’s quiet.
Software that has no restrictions regarding its use is called ______________________.
To keep related files together you should store them in a ________________.
Web addresses are called _____________.
Search engines search indexes of key terms that are often compiled by a software program called a __________________.
When you transfer a file from another computer to your own , it’s called ___________________.
__________________ files contain only text, use only a limited set of characters, and have almost no formatting so they are easy to transfer.
Wednesday, January 21, 2009
Welcome to Mr. Chiarelli's Computer Science Blog 2009
Welcome to Mr. Chiarelli's Computer Classes for 2008-2009
This blog will post information about upcoming tests, assignments and any other relevant info you need to succeed. From time to time there will be test and assignment hints also posted here.
Your blogs will be marked every second Friday. You should have 2 postings per week for a total of 4 postings. One or two paragraphs per post is required. Full sentences please. I mark the blogs Friday morning so you should complete them no later than Thursday night.
I hope you find your computer course with me useful , interesting and rewarding.
Your current marks are posted on First Class. You can access First Class from home in two ways.
Download the actual program from
http://www.centrinity.com/clientdownloads/FC80WinDownloadPage
then goto to the Collabrate Menu and under setup type in the server address
mail.hwcdsb.ca
OR
you can access FC from the internet on a web based form at this address
http://mail.hwcdsb.ca/
Best wishes Mr. Chiarelli
This blog will post information about upcoming tests, assignments and any other relevant info you need to succeed. From time to time there will be test and assignment hints also posted here.
Your blogs will be marked every second Friday. You should have 2 postings per week for a total of 4 postings. One or two paragraphs per post is required. Full sentences please. I mark the blogs Friday morning so you should complete them no later than Thursday night.
I hope you find your computer course with me useful , interesting and rewarding.
Your current marks are posted on First Class. You can access First Class from home in two ways.
Download the actual program from
http://www.centrinity.com/clientdownloads/FC80WinDownloadPage
then goto to the Collabrate Menu and under setup type in the server address
mail.hwcdsb.ca
OR
you can access FC from the internet on a web based form at this address
http://mail.hwcdsb.ca/
Best wishes Mr. Chiarelli
Thursday, June 26, 2008
Some Great Student Blogs
If you are wondering what some of the better student blogs look like, check out the links below
http://laughingmanrhf.blogspot.com/
http://dee-dianasblog.blogspot.com/
http://laughingmanrhf.blogspot.com/
http://dee-dianasblog.blogspot.com/
Downloading C# Express
I noticed that microsoft is making it difficult for you to access the old 2005 version of C#. Use the link below.
http://www.microsoft.com/express/2005/
Try to download the offline version, so you can burn the image file .iso to a cd/dvd.
Your still free to install the newer version, but there may be some issues when you transfer your work from home to school.
http://www.microsoft.com/express/2005/
Try to download the offline version, so you can burn the image file .iso to a cd/dvd.
Your still free to install the newer version, but there may be some issues when you transfer your work from home to school.
Subscribe to:
Posts (Atom)