SRL Archive - General

Can someone help me in C# (i'll treat ya with RSGP <3)


P1nky

2011-09-15 13:38:33

heyyy i need some help in C# … basically a multiple question thing.
THESE QUESTIONS:






1 Which of the following is a valid identifier?
A. namespace
B. variable 1
C. exampleOfAValue
D. 3value
E. value#1


2 The number 768 is an example of a ________type.
A. bool
B. integer
C. floating-point
D. struct
E. decimal


3 Which of the following is a reference type?
A. int
B. bool
C. string
D. decimal
E. integer


4 The character that cannot be used with an identifier is:
A. .
B. $
C. *
D. #
E. all of the above


5 Which of the following is a reserved keyword?
A. Console
B. data
C. int
D. System
E. all of the above



6 One of primary differences between float, double, and decimal is:
A. float is used to represent more significant digits.
B. double is normally used with large monetary values.
C. decimal is not used to display negative values.
D. double does not require suffixing a numeric literal with a value such as m or f.
E. decimal is primarily used to represent small monetary values that require a $ for formatting.


7 Which of the following is a valid declaration for a variable to store the name of this textbook?
A. string name of book;
B. char nameOfBook;
C. boolean nameOfBook;
D. string bookName;
E. char book Name;


8 Types are implemented in C# using:
A. classes
B. types
C. objects
D. names
E. programs


9 An object of the int class is:
A. 47.98
B. 47
C. int class
D. type object
E. type interger


10 What would be an appropriate declaration for a variable to indicate whether a value has reached its upper limit?
A. int upperLimit;
B. upperLimit reached;
C. bool upperLimit;
D. Boolean upperLimit;
E. string upperLimit;







11 Adding the keyword const to a declaration:
A. places a value in memory that cannot be changed
B. declares variables of the constant type
C. must be done by placing it after the identifier in the declaration
D. can only be done with the integral types
E. is prohibited in C#


12 Which statement increases the result by 15?
A. 15 + = result;
B. 15 =+ result;
C. result =+ 15;
D. result += 15;
E. result = 15 +;


13 What is stored in the variable ans as a result of the arithmetic expression, given the following declarations?

int ans = 0, vl = 10, v2 = 19;
ans = –v2 % vl++;

A. 1.8
B. 9
C. 8
D. 2
E. none of the above


14 What is stored in variable ans as a result of the arithmetic expression, given the following declarations?

int ans = 10
int vi = 5;
int v2 = 7;
int v3 = 18;

ans += vi + 10 * (v2– / 5) + v3 / v2;

A. 18
B. 32
C. 28
D. 30
E. none of the above


15 Which of the following formats the number 86 to display with two digits to the right of the decimal?
A. {O:C}
B. {O:c}
C. {0:f2}
D. all of the above
E. none of the above


16 Check mark the expressions that are valid identifiers?
If they are invalid, indicate why.
A. intValue &#8194;&#8194;&#8194;&#8194;&#8194;
B. value#l &#8194;&#8194;&#8194;&#8194;&#8194;
C. the first value &#8194;&#8194;&#8194;&#8194;&#8194;
D. _value1 &#8194;&#8194;&#8194;&#8194;&#8194;
E. AVALUE &#8194;&#8194;&#8194;&#8194;&#8194;


17 For each of the following, code a variable decalaration using the best choice for data type

A. a counter for the number of correct responses
&#8194;&#8194;&#8194;&#8194;&#8194;

B the amount of money you owe on a credit card
&#8194;&#8194;&#8194;&#8194;&#8194;

C the name of your hometown
&#8194;&#8194;&#8194;&#8194;&#8194;

D the grade you hope to obtain on the next exam


E the letter grade you hope is recorded at the end of the term for this course
&#8194;&#8194;&#8194;&#8194;&#8194;


18 For each of the variable declarations in problem 18, add an appropriate compile-time initialization.

A. counter for the number of correct responses begins with zero
&#8194;&#8194;&#8194;&#8194;&#8194;

B amount of money you owe on a credit card is zero
&#8194;&#8194;&#8194;&#8194;&#8194;

C name of the hometown or the city where your school is located
&#8194;&#8194;&#8194;&#8194;&#8194;

D grade on the next exam is 100
&#8194;&#8194;&#8194;&#8194;&#8194;

E grade to be recorded at the end of the term for this course is an A
&#8194;&#8194;&#8194;&#8194;&#8194;


19 int x = 2;
int y = 6;
int z = 10;

What will be value of each of these variables after each of the following statements is executed? (For each exercise, use the original declaration..

x y z
A. z += ++y % 2; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
B. x = y + 14 - z / 7; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
C. x = y * z / 2 - x * z; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
D. x %= –z - y * 2; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
E. y = (z - y) * 2 + –y; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;


20 double x = 2.5;
double y = 6.9;
double z = 10.0;

What will be value of each of these variables after each of the following statements is executed? (For each exercise, use the original declaration.

x y z
A. z *= y++ % 7; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
B. x = (int) y + (14 - z /7); &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
C. x = z / 3 * –y; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
D. z /= (int) y / x; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;
E. z = x + Y / 4; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194; &#8194;&#8194;&#8194;&#8194;&#8194;


21 What will be the output from each of the following statements?
A. Console.Write("Result is {O:c}", 67); &#8194;&#8194;&#8194;&#8194;&#8194;
B. Console.Write("Number {O:fO} is {1:c}", 1,3); &#8194;&#8194;&#8194;&#8194;&#8194;
C. Console.Write("{O:fO}- {1:c}", 1,3 * 2); &#8194;&#8194;&#8194;&#8194;&#8194;
D. Console.Write(" {O:fO} result" + "xyz {1:f2}", 1,25); &#8194;&#8194;&#8194;&#8194;&#8194;
E. Console.Write("This is the {O:fO}st example: {1:f2}", 1,3); &#8194;&#8194;&#8194;&#8194;&#8194;


22 Explain how a variable differs from a constant.
&#8194;&#8194;&#8194;&#8194;&#8194;


23 Explain how type, class, and object are related to a string.
&#8194;&#8194;&#8194;&#8194;&#8194;


Frement

2011-09-15 14:10:20

Why not just ask here? Anyone with the proper knowledge would help you, I'm sure of it, no matter what you paid or didn't pay.

P1nky

2011-09-15 14:14:41

Once i get home i'll make sure to post the questions. :)

FornxXx

2011-09-15 16:39:16

haha hi pinky long time no see *Lol i always say that when i see you xD*

C# huh? you advanced since the last time i saw you :P gg bro

n3ss3s

2011-09-20 18:50:12

I'll help you with whatever it is, add [email]x0riax@hotmail.com[/email] (I'm EST time zone)

P1nky

2011-09-20 19:17:28

From: n3ss3s
I'll help you with whatever it is, add [email]x0riax@hotmail.com[/email] (I'm EST time zone)


added you mate i'll wait for you. :)

n3ss3s

2011-09-20 21:13:14

Uhh, when I try to add someone it tells me that it can't be done right now, and I think people are unable to add me too, just pm me and try to include as much of what you need answered as you can

P1nky

2011-09-20 22:36:49

i think i got like only 10 done but i just posted the questions please help <3

Daniel

2011-09-26 04:46:11

Re-read your textbook/notes. These are very basic questions which you should be able to answer.

Frement

2011-09-26 10:01:41

1. D
2. E
3. D
4. B
5. -
6. D? Just a guess
7. A
8. E
9. C
10. D
11. E
12. A
13. C
14. D
15. B
16. B
17. C
18. D
19. E
20. E
21. E
22. C (more accurate answer if you can give multiple choises: A & C -> compile and execute)
23. E? Just a guess
24. C
25. D
26. Go Laugh Out Loud
Think Happy
^ notice that there are two lines.

Heres my attempts, if anyone notices anything wrong, please tell me what and why :)

P1nky

2011-11-22 14:15:02

Updated the Quiz, Please Help!

btw #17 - #23 are not multiple choice!

and every multiple question can have more than one answer! <3

Kyle Undefined

2011-11-22 19:39:09

Ok, I figured I'd give this a shot. It's been awhile since I've done C# so forgive me if a few are off.


1 Which of the following is a valid identifier?
C. exampleOfAValue

2 The number 768 is an example of a ________type.
B. integer

3 Which of the following is a reference type?
C. string

4 The character that cannot be used with an identifier is:
E. all of the above

5 Which of the following is a reserved keyword?
C. int

6 One of primary differences between float, double, and decimal is:
B. double is normally used with large monetary values.

7 Which of the following is a valid declaration for a variable to store the name of this textbook?
D. string bookName;

8 Types are implemented in C# using:
A. classes

9 An object of the int class is:
B. 47

10 What would be an appropriate declaration for a variable to indicate whether a value has reached its upper limit?
C. bool upperLimit;

11 Adding the keyword const to a declaration:
A. places a value in memory that cannot be changed

12 Which statement increases the result by 15?
D. result += 15;

13 What is stored in the variable ans as a result of the arithmetic expression, given the following declarations?
int ans = 0, vl = 10, v2 = 19;
ans = --v2 % vl++;
B. 9

14 What is stored in variable ans as a result of the arithmetic expression, given the following declarations?
int ans = 10
int vi = 5;
int v2 = 7;
int v3 = 18;
ans += vi + 10 * (v2-- / 5) + v3 / v2;
B. 32

15 Which of the following formats the number 86 to display with two digits to the right of the decimal?
C. {0:f2}

16 Check mark the expressions that are valid identifiers. If they are invalid, indicate why.
A. intValue ./
B. value#l x - Invalid character
C. the first value x - Spaces are not allowed
D. _value1 ./
E. AVALUE ./

17 For each of the following, code a variable decalaration using the best choice for data type
A. a counter for the number of correct responses
- int counter;
B the amount of money you owe on a credit card
- decimal moneyOwed;
C the name of your hometown
- string hometownName;
D the grade you hope to obtain on the next exam
- int grade;
E the letter grade you hope is recorded at the end of the term for this course
- string letterGrade;

18 For each of the variable declarations in problem 18, add an appropriate compile-time initialization.
A. counter for the number of correct responses begins with zero
- int counter = 0;
B amount of money you owe on a credit card is zero
- decimal moneyOwed = 0m;
C name of the hometown or the city where your school is located
- string hometownName = "Mobile";
D grade on the next exam is 100
- int grade = 100;
E grade to be recorded at the end of the term for this course is an A
- string letterGrade = "A";

19
int x = 2;
int y = 6;
int z = 10;
What will be value of each of these variables after each of the following statements is executed? (For each exercise, use the original declaration..
x y z
A. z += ++y % 2;
- 11
B. x = y + 14 - z / 7;
- 18.57 // Error
C. x = y * z / 2 - x * z;
- 10
D. x %= --z - y * 2;
- -1 // Error
E. y = (z - y) * 2 + --y;
- 13

20
double x = 2.5;
double y = 6.9;
double z = 10.0;
What will be value of each of these variables after each of the following statements is executed? (For each exercise, use the original declaration.
x y z
A. z *= y++ % 7;
- 79
B. x = (int) y + (14 - z /7);
- 19.57
C. x = z / 3 * --y;
- 19.66
D. z /= (int) y / x;
- 3.57
E. z = x + Y / 4;
- 4.22

21 What will be the output from each of the following statements?
A. Console.Write("Result is {O:c}", 67);
- Result is $67.00
B. Console.Write("Number {O:fO} is {1:c}", 1,3);
- Number 1 is $3.00
C. Console.Write("{O:fO}- {1:c}", 1,3 * 2);
- 1-$6.00
D. Console.Write(" {O:fO} result" + "xyz {1:f2}", 1,25);
- 1 resultxyz 25.00
E. Console.Write("This is the {O:fO}st example: {1:f2}", 1,3);
- This is the 1st example: 3.00

22 Explain how a variable differs from a constant.
A variable differs from a constant because they can change value after being declared. Constants are declared and can not be changed.


23 Explain how type, class, and object are related to a string.

Aftermath

2011-11-23 16:14:41

Just putting it out there - you should never store currency in a floating-point data type such as a double. In C#, currency would be stored in a decimal.

speedster

2012-01-16 10:40:05

Uhmm, wouldn't have google answered the same questions ?

DeiJaiVui

2012-01-22 09:57:48

I once found a tool made by googled that answered any question you typed in. Can't seem to find it now. :(