Exam 4: Introduction to Classes,Objects,Methods and Strings

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

In the code: Console.WriteLine($"Initial name is: {myAccount.Name}"); the expression myAccount.Name explicitly invokes the Name property's get accessor to get the value of myAccount's instance variable name.

Free
(True/False)
4.9/5
(29)
Correct Answer:
Verified

False

You should think of a C# class's attributes as instance variables.

Free
(True/False)
4.9/5
(44)
Correct Answer:
Verified

False

It's always better to get the errors out of your programs at execution time,if possible,rather than at compilation time.

Free
(True/False)
4.7/5
(31)
Correct Answer:
Verified

False

Attempting to use an uninitialized local variable is a runtime error.

(True/False)
4.7/5
(31)

Which of the following statements is false

(Multiple Choice)
4.9/5
(29)

An important difference between constructors and methods is that constructors must specify a return type of void.

(True/False)
4.8/5
(32)

Consider the code: Public void SetName(string accountName) { Name = accountName;// store the account name } Which of the following statements is false

(Multiple Choice)
4.8/5
(34)

Consider the code: MyAccount.Name = theName; Which assigns the string theName to myAccounts's Name property.Which of the following is false regarding when property Name is invoked by the expression myAccount.Name on the left of an assignment

(Multiple Choice)
4.9/5
(36)

Which of the following statements about creating,compiling and running a Visual C# project with two classes is false

(Multiple Choice)
4.8/5
(36)

By default,instance variables are not initialized.

(True/False)
4.8/5
(38)

Normally,constructors are declared private.

(True/False)
4.8/5
(25)

When implementing a method of a class,the method should access the class's instance variables directly.

(True/False)
4.8/5
(35)

Which of the following properly declares an auto-implemented Name property of type string

(Multiple Choice)
4.7/5
(30)

By default,everything in a class is ________,unless you specify otherwise by providing access modifiers. a) public b) private c) protected d) None of the above.

(True/False)
4.9/5
(31)

The fact that we could create and manipulate an Account object without knowing its implementation details is called ________.This is one of the most powerful software-engineering benefits of object-oriented programming.

(Multiple Choice)
4.7/5
(37)

Which of the following statements is false

(Multiple Choice)
4.8/5
(36)

Method ReadLine reads a whole line,including all the characters the user types up to and including the newline that the user typed by pressing Enter.

(True/False)
4.7/5
(27)

Each class you create becomes a new type you can use to create objects,so C# is a(n)________ programming language.

(Multiple Choice)
4.8/5
(20)

Type ________ is designed to precisely represent numbers with decimal points,especially monetary amounts.

(Multiple Choice)
4.9/5
(37)

Instance variables are required to be explicitly initialized before they're used in a program.

(True/False)
4.9/5
(32)
Showing 1 - 20 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)