The University of Texas – Pan American

Slides:



Advertisements
Similar presentations
Pemrograman VisualMinggu …12… Page 1 MINGGU Ke Duabelas Pemrograman Visual Pokok Bahasan: File and Stream Tujuan Instruksional Khusus: Mahasiswa dapat.
Advertisements

Files & Streams. Files Introduction Files are used for long-term retention of large amounts of data, even after the program that created the data terminates.
MIS316 – BUSINESS APPLICATION DEVELOPMENT – Chapter 14 – Files and Streams 1Microsoft Visual C# 2012, Fifth Edition.
CIS 200 Final Review. New Material Data Structures.
The University of Texas – Pan American
CIS 200 Test 02 Review. Windows Forms, GUI Programming  Elements  Textboxes  Tab Groups  Checkboxes  Fields  Event Handlers  Visual Studio Designer.
1 14/10/58Dr.Mud-Armeen Munlin 1 Files and Streams ผศ. ดร. หมัดอามีน หมันหลิน Faculty of IST, MUT
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Ticket Information Application Introducing Sequential-Access Files.
Reference: Lecturer Lecturer Reham O. Al-Abdul Jabba lectures for cap211 Files and Streams- I.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Chapter 14: Files and Streams. 2Microsoft Visual C# 2012, Fifth Edition Files and the File and Directory Classes Temporary storage – Usually called computer.
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 11: Files and Streams -- Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
CSCI 4333 Database Design and Implementation – Exercise (1) Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
CSCI 6307 Foundation of Systems – Exercise (4) Xiang Lian The University of Texas – Pan American Edinburg, TX
CSCI/CMPE 4341 Topic: Programming in Python Chapter 7: Introduction to Object- Oriented Programming in Python – Exercises Xiang Lian The University of.
Files and Streams Lec Introduction  Files are used for long-term retention of large amounts of data, even after the program that created the.
CSCI 4333 Database Design and Implementation – Exercise (5)
CIS 200 Test 02 Review.
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming UTPA – Fall 2012 This set of slides is revised from lecture.
CSCI 3327 Visual Basic Chapter 11: Files and Streams
Files.
18 Files and Streams.
CSCI 3327 Visual Basic Chapter 11: Files and Streams
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
The University of Texas – Pan American
The University of Texas – Pan American
Sequential Input and Output using Text Files
File Input/Output (I/O)
CSCI 3328 Object Oriented Programming in C# Chapter 7: Arrays
The University of Texas Rio Grande Valley
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
Files & Streams.
CSCI 3327 Visual Basic Review: Final Exam
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# Review: Exam II
CSCI 4333 Database Design and Implementation – Exercise (5)
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
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
The University of Texas – Pan American
Files and Streams Lect10 GC201 12/1/2015.
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
CIS16 Application Development and Programming using Visual Basic.net
CSCI 3328 Object Oriented Programming in C# Chapter 11: Files and Streams UTPA – Fall 2012 This set of slides is revised from lecture slides of Prof.
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 11: Files and Streams -- 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: Windows GUI Classes File and Directory LINQ queries to search through directories sequential-access file processing Classes FileStream, StreamReader, StreamWriter, FileStream, and BinaryFormatter

Multiple Choices The smallest data item a computer can process is called a ________. A. database B. byte C. file D. bit A group of related records is stored in a ____. A. file B. field C. bit D. byte Data maintained in a file is called _____. A. persistent data B. bits C. secondary data D. databases Methods from the ____ class can be used to write data to a file. A. StreamReader B. WriteFile C. StreamWriter D. None of the above Namespace ____ provides the classes and methods you need to perform file processing. A. System.IO B. System.Files C. System.Stream D. System.Windows.Forms A(n) ____ allows the user to select a file to open. A. CreateFileDialog B. OpenFileDialog C. MessageBox D. SaveFileDialog

Multiple Choices (cont'd) StreamReader method _____ reads a line from a file. A. ReadLine B. Read C. ReadAll D. ReadToNewline A _____contains information that is read in the order it was written. A. sequential-access file B. StreamWriter C. StreamReader D. None of the above Methods from class _____ can be used to read data from a file. A. StreamWriter B. FileReader C. StreamReader D. None of the above Ultimately, all data items processed by a computer are reduced to combinations of _________. A. 0-9 B. 'a'-'z' C. 'A'-'Z' D. 0's and 1's Method Serialize of class BinaryFormatter takes a(n) _______ and a(n) __________ as arguments. A. object and Stream B. Stream and object C. File and object D. object and File

True / False Statement Creating instances of classes File and Directory is impossible. Typically, a sequential file stores records in order by the record-key fields. Class StreamReader inherits from class Stream. Any class can be serialized to a file. Classes StreamReader and StreamWriter are used with sequential-access files. The class BinaryFormatter is under the namespace System.Runtime.Serialization.Formatters.Binary. Class StreamReader inherits from class TextReader

True / False Statement (cont'd) The ListBox control allows only a single selection (like a RadioButton). Controls such as form, GroupBox, Panel, and TabControl are all containers. All mouse events use the same event arguments class. A ComboBox control typically has a drop-down list. Deleting a parent node in a TreeView control deletes its child nodes.

Writing the C# Code A student record has information such as student ID, last name, first name, birth year, and so on. Declare a class for a student record Write a method to write records into a file, using StreamWriter Write a method to read records from a file into a record array, using StreamReader Use an LINQ query to find those students with the birth year > 1981, and write them into another file using BinaryFormatter