ISDS 505 Midterm Chapter 2 Methods- Question and answers A graded.
When you use a number such as 45 in a C# program, the number is a - Answer- literal constant A variable declaration must contain all of the following - Answer- a data type, an identifier, and an ending semicolon True or false? Two variables of the same type can be declared in the same statement. - Answer- true Assume that you have two variables declared as int var1 = 3; and int var 2= 8; Write the statement that would WriteLine "838" using placeholders. - Answer- WriteLine("{0}{1}{0}", var2, var1); Assume that you have a variable declared as int var1 = 3; What is the value of 22 % var1? a. 21 b. 7 c. 1 d. 0 - Answer- c. 1 Assume that you have a variable declared as int var1 = 3; What is the value of 22/var1? a. 21 b. 7.333 c. 7 d. 1 - Answer- c. 7 //program does not give decimals unless directed to. Note the int data type. What is the value of var2 in the following statement? int var1 = 3; var2 = ++ var1; - Answer- 4 A variable that can hold two values, true and false, is what data type? - Answer- bool What is the comparison operator for "not equal to"? - Answer- != What is the value of the expression 6 = 7; ? a. 0 b. 1 c. true d. false - Answer- d. false Which of the following C# data types cannot contain floating-point numbers? a. float b. double c. decimal d. int - Answer- d. int Assume you've declared a variable as double hourly = 13.00; what will the statement WriteLine(hourly) ; display?
Geschreven voor
- Instelling
- ISDS 505
- Vak
- ISDS 505
Documentinformatie
- Geüpload op
- 18 maart 2024
- Aantal pagina's
- 5
- Geschreven in
- 2023/2024
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
isds 505 midterm chapter 2 methods question and a