






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A trial exam solution for the comm 205 course at concordia university. It covers various programming concepts and constructs, such as variable declaration, numeric data types, conditional statements, loops, and event handling. Code fragments and multiple-choice questions to assess the student's understanding of these topics. The level of detail and the range of topics covered suggest that this document could be useful for university students enrolled in a programming or computer science course, particularly those taking the comm 205 course at concordia university. The document could serve as a study guide, lecture notes, or a practice exam to help students prepare for their midterm or final exams.
Typology: Exams
1 / 10
This page cannot be seen from the preview
Don't miss anything!







double txtNotebooks, txtTablets, total;
txtNotebooks = 1100; txtTablets 450;
lblTotal.Text = total.ToString();
double b = a;
The above code has a problem. To correct it you need to usea. Try-catch
b. TryParse()
c. Math class
d. Casting
b. price >= 10 && price <=20;
c. 20 >= price >= 10;
d. 10 <= price <= 20;
If quantity has a value of 5, what is the value of discount after these statements are executed?
switch (quantity) {
case 1: case 2: case 3:
discount = 0; break;
discount = .1; default: discount = .2;
break;
break;
}
The switch statement has the following structure:
switch (test variable or expression) { case value_1: … case value_2: … } The valid types of test variable (or expression) include all of the following, except:
a. string
b. double
c. char
d. int
case "ca": country = "Canada"; break; case "fr": country = "France"; break; case "it": country = "Italy"; break; default: country = "No country found"; break; }
lblCountry.Text = country;
What is the term for a method that responds to events?a. event procedure
b. event exception
c. event wiring
d. event handler
The variable averageClassSize would be declared asa. Short
b. double
c. int
d. decimal
Customers who have at least 3 years of membership or spent at least $2000 at ourstore will get the star customer status. To implement such a rule we would use a. "if - else if"
b. ">=" and "||"
c. ">=" and "&&"
d. ">" and "&&"
Labels can be used ...a. for outputs
b. for inputs
c. both for inputs and outputs
d. only for labeling controls
What you may have to use when you want to convert between different numeric types ina statement a. Conversion
b. ToString()
c. TryParse()
d. Casting
What is wrong in the following code?
int sum = 0; int i;
for (int i = 10; i > 0; i --)
sum += i; i++;
a. i is changed within the body of the loop
b. Nothing
c. The starting values is 10
d. the decement i-- is used
To read exam results from a text file one would usea. switch
b. nested if
c. for
d. while
The following statement about a local variable is true: a. if a data item is needed only within a single method, it should be stored in a localvariable
b. a local variable is declared at the class level
c. a local variable is available in all methods within a form
d. a local variable exists in memory until the form is closed
In an organization when an employee is hired they get a set starting salary. Every second year the salary grows by 3%. Starting with the 11 years of service the salary willgrow by 2% every second year. Write a program fragment that takes number of years ofservice from a text box txtYears, and starting salary from txtStart, calculates salary for every second year (starting with year 1), and displays it in a list box lstSalary. Use data validation for the inputs to make sure they are numeric. (10 points)
The following statement about constants/variables is true, except: a. A variable may be assigned a value after it is declared
b. A constant must be assigned a value when it is declared
c. A constant cannot be assigned a value after it is declared
d. A variable must be assigned a value when it is declared
What is true abut the following loop
decimal counter = 1;
do{
sum += counter;
}
while(counter < 1) a. will never run
b. is an infinite loop
c. will not run since counter is not an int
d. will run one time
A variable taxRefund should be declared asa. Ulong
b. double
c. decimal
d. int