早教吧 育儿知识 作业答案 考试题库 百科 知识分享

C#问题~~~1Whichofthefollowingisalegaldeclarationofastring?A.stringfirstName=newjane;B.stringfirstName='jane';C.string[]firstName="jane";D.stringfirstName='j';E.stringfirstName="jane";=========================2.Whic

题目详情
C# 问题~~~
1 Which of the following is a legal declaration of a string?
A. string firstName = new jane;
B. string firstName = 'jane';
C. string[] firstName = "jane";
D. string firstName = 'j';
E. string firstName = "jane";
=========================
2. Which of the following statements is true about a named constant?
A. You must assign a value to a constant when you create it.
B. It must be written with all uppercase letters.
C. You cannot use constants in equations.
D. None of the above
E. All of A, B and C.
==============================
3. Given the below declarations, the result of a/b is:
int a = 45;
int b = 2;
A. 22.5
B. 23
C. 22
D. 1
E. The division is illegal because the result is not a whole number
================================================
4. If a method does not return a value, its return type is:
A. void
B. 0
C. null
D. false
E. nothing
=======================================
5. When calling or invoking a method that accepts parameters, the argument:
A. is always a constant value
B. is always a variable value
C. is always a string
D. can be either a constant or variable value
E. must be a reference variable
===================================
6. In the method header below, message is an example of a(n):
static void sayHello(string message)
A. formal parameter
B. access modifier
C. actual parameter
D. constant value
E. reference parameter
▼优质解答
答案和解析
标注了*的是答案:
//=============================
1 Which of the following is a legal declaration of a string?
A. string firstName = new jane;
B. string firstName = 'jane';
C. string[] firstName = "jane";
D. string firstName = 'j';
E. string firstName = "jane";//*声明字符串就是这样,或者string firstName = new string("jane");
=========================
2. Which of the following statements is true about a named constant?
A. You must assign a value to a constant when you create it.//*常量必须在创建时赋值
B. It must be written with all uppercase letters.//这仅仅是建议,不是必须
C. You cannot use constants in equations.//不能在表达式中使用还要常量干嘛?
D. None of the above
E. All of A, B and C.
==============================
3. Given the below declarations, the result of a/b is:
int a = 45;
int b = 2;
A. 22.5
B. 23
C. 22 //*整型除法小数位自动截断
D. 1
E. The division is illegal because the result is not a whole number
================================================
4. If a method does not return a value, its return type is:
A. void //*方法没有返回值时,返回类型是void
B. 0
C. null
D. false
E. nothing
=======================================
5. When calling or invoking a method that accepts parameters, the argument:
A. is always a constant value
B. is always a variable value
C. is always a string
D. can be either a constant or variable value //*调用方法的时候方法参数值可以是常量也可以是变量
E. must be a reference variable
===================================
6. In the method header below, message is an example of a(n):
static void sayHello(string message)
A. formal parameter //*message在此方法中始终为形式参数
B. access modifier
C. actual parameter //a(n)的结果为实际参数
D. constant value
E. reference parameter //ref string message才可以称为引用参数