The University of Texas – Pan American

Slides:



Advertisements
Similar presentations
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Advertisements

CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look 1 Xiang Lian The University of Texas – Pan American Edinburg,
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 3: Control Structures (Part 1) – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
Chapter 5 - Writing a Problem Domain Class Definition1 Chapter 5 Writing a Problem Domain Class Definition.
The University of Texas – Pan American
Object-Oriented Programming - Classes, Objects Methods, Strings 1 -Based on slides from Deitel & Associates, Inc. - Revised by T. A. Yang.
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
CSCI/CMPE 4341 Topic: Programming in Python Review: Exam I Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Chapter 4 Introduction to Classes, Objects, Methods and strings
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX.
Chapter 3 (B) 3.5 – 3.7.  Variables declared in a function definition’s body are known as local variables and can be used only from the line of their.
CSCI 4333 Database Design and Implementation – Exercise (5) Xiang Lian The University of Texas – Pan American Edinburg, TX
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
CPSC 233 Tutorial 5 February 9 th /10 th, Java Classes Each Java class contains a set of instance variables and methods Instance Variables: Type.
CSCI 3328 Object Oriented Programming in C# Chapter 6: Methods – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 7: Introduction to Object- Oriented Programming in Python – Exercises Xiang Lian The University of.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 5: Functions – Exercises Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Chapter 3 Introduction to Classes, Objects Methods and Strings
Yanal Alahmad Java Workshop Yanal Alahmad
Yanal Alahmad Java Workshop Yanal Alahmad
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
The University of Texas – Pan American
The University of Texas – Pan American
The University of Texas Rio Grande Valley
Chapter 3 Introduction to Classes, Objects Methods and Strings
CSCI 3328 Object Oriented Programming in C# Chapter 7: Arrays
The University of Texas Rio Grande Valley
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I UTPA – Fall 2012 This set of slides is revised from lecture slides.
Chapter 3 Introduction to Classes, Objects Methods and Strings
The University of Texas – Pan American
The University of Texas – Pan American
The University of Texas – Pan American
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I – Exercises UTPA – Fall 2012 This set of slides is revised from lecture.
CSCI 3328 Object Oriented Programming in C# Review: Exam I
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look – Exercises UTPA – Fall 2012 This set of slides is revised from.
The University of Texas – Pan American
The University of Texas – Pan American
The University of Texas – Pan American
CSCI 3328 Object Oriented Programming in C# Review: Exam I
The University of Texas Rio Grande Valley
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II – Exercises UTPA – Fall 2012 This set of slides is revised from.
CSCI 4333 Database Design and Implementation – Exercise (5)
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall 2012 This set of slides is revised from lecture.
The University of Texas – Pan American
CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams -- Exercises UTPA – Fall 2012 This set of slides is revised from lecture slides.
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects – Exercises UTPA – Fall 2012 This set of slides is revised.
The University of Texas – Pan American
CSCI 6307 Foundation of Systems – Exercise (1)
CSCI 3327 Visual Basic Review: Exam I
CSCI 3328 Object Oriented Programming in C# Review: Exam II
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
CSCI 3328 Object Oriented Programming in C# Chapter 6: Methods
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look UTPA – Fall 2012 This set of slides is revised from lecture.
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
Object Oriented Programming in java
The University of Texas – Pan American
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises UTPA – Fall 2012 This set of slides is revised from lecture.
CSCI 3328 Object Oriented Programming in C# Review: Exam II
CSCI 6307 Foundation of Systems – Exercise (5)
CSCI 3328 Object Oriented Programming in C# Chapter 7: Arrays – Exercises UTPA – Fall 2012 This set of slides is revised from lecture slides of Prof.
CSCI 4333 Database Design and Implementation – Exercise (1)
Presentation transcript:

The University of Texas – Pan American CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects – Exercises Xiang Lian The University of Texas – Pan American Edinburg, TX 78539 lianx@utpa.edu This set of slides is revised from lecture slides of Prof. John Abraham. -- Xiang Lian

Objectives In this chapter, you will Do some exercises about classes and objects in C#

Multiple Choices A class can have __________ object(s). A. only 1 B. only 2 C. between 1 and 3 D. more than 1 Every class declaration contains keyword ____ followed immediately by the class’s name A. keyword B. public C. void D. class Which of the following statements is true to create a new object of class MyClass in C#? A. MyClass obj = new MyClass () B. MyClass obj = new MyClass ; C. MyClass *obj = new MyClass (); D. MyClass obj = new MyClass (); C# provides the following simple types for storing real numbers except for ________. A. real B. float C. double D. decimal

Multiple Choices (cont'd) Which of the following statements is the correct usage of Convert in C#? A. Console.Convert(); B. Convert.ToDecimal(); C. Convert.ReadLine(); D. Convert.ToDecimal(Console.ReadLine()); Return type _______indicates that a method will not return any information when it completes its task. A. NULL B. Nil C. Void D. void Which of the following statements is correct? A. Console.WriteLine({0:C}, 3); B. Console. Write("Hello world!"); C. Console.ReadLine(x); D. Console.Read(x);

True or False Statements 1. By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter 2. A property's get accessor enables a client to modify the value of the instance variable associated with the property 3. Empty parentheses following a method name in a method declaration indicate that the method does not require any parameters to perform its task

True or False Statements (cont'd) 4. After defining a property, you can use it the same way you use a method, but with empty parentheses, because no arguments are passed to a property 5. Variable declared in the body of a particular method are known as instance variables and can be used in all methods of the class 6. A property declaration must contain both a get accessor and a set accessor