QUIZ

CHAPTER 2

Your Name:



2.1 Given the definitions in this chapter, a type

(a) defines data and functions
(b) represents a data value
(c) is comprised of objects
(d) is either a struct or a class

2.2 Given the definitions and capitalization conventions in this chapter, the construct Part.Member can only be interpreted as accessing

(a) a property of an object
(b) a method of a class
(c) a property of a class
(d) a field of an object

2.3 To join two strings together, we use
(a) concat
(b) +
(c) &
(d) nothing

2.4 Reading an integer is done with

(a) Console.ReadLine();
(b) int.Parse(Console.ReadLine());
(c) int.Parse.Console.Readline();
(d) Parse(Console.ReadLine());


2.5 If two strings are to be read, they must be
(a) separated by semicolons
(b) separated by spaces
(c) each enclosed in quotes
(d) on separate lines


2.6 In the construct DateTime.Today, Today is a

(a) property
(b) method
(c) constructor
(d) field


2.7 If endOfYear and now are both DateTime variables, what is the type of endOfYear-now?

(a) DateTime
(b) int
(c) TimeSpan
(d) cannot tell


2.8 If test is a Random object, then what expression will return a value between 0 and 100?

(a) Next.test(100)
(b) test.Next(100)
(c) test(0,100)
(d) test(Next(100))


2.9 To get access to the Console class, we start a program with which directive?

(a) access Console;
(b) import Console;
(c) using Console;
(d) using System;

2.10 To create and start an object representing a program called Test, as described in this book, we use which statement?

(a) new Test().Go();
(b) new Test();
(c) Go(new Test());
(d) Go.Test().Main();