Event-Driven Programming PDF Past Paper

Summary

This document contains a past paper on event-driven programming, focusing on questions related to file handling, streams, and other programming concepts. The questions cover various aspects of programming and can be used for revision or preparation.

Full Transcript

Event-Driven Programming Question 1 This function retrieves the value from the stream without altering the file pointer. Peek() Question 2 These indicate a source that sends a series of bytes, such as an I/O device. Streams Question 3 Which attribute establishes if a stream is capable of acc...

Event-Driven Programming Question 1 This function retrieves the value from the stream without altering the file pointer. Peek() Question 2 These indicate a source that sends a series of bytes, such as an I/O device. Streams Question 3 Which attribute establishes if a stream is capable of accepting position requests? CanSeek Question 4 Out of all the file extensions, which one is meant for reusable components?.dll Question 5 This property ensures that if the stream can be read, it returns true. CanRead Question 6 To establish a byte-oriented stream that is associated to a file, which of the following.NET classes is used? FileStream Question 7 The name, version number, and kind of mapping information are included in this part of an assembly. Manifest Question 8 If there isn't an existing file, which of the following FileModes opens it and creates a new one? OpenCreate Question 9 With which syntax is a new instance of the StreamReader class initialized for a specified file name? public StreamReader (string filename); Question 10 Which code from the list below creates a FileStream object? FileStream(string fileName, FileMode fileMode) Question 11 The file name to be opened is specified by this code. StreamReader(string fileName) Question 12 Which syntax causes any buffered data to be pushed to the stream and clears all buffers for the current writer? public override void Flush(); Question 13 In order to read content from the input stream, which of the following is the CORRECT syntax? int val = streamReader.Read(); Console.WriteLine(val); Question 14 Regarding GAC, which of the following claims is TRUE? It makes it possible for multiple apps to share assembling. Question 15 A block of bytes is read from the stream using which of the following lines of code? public override int Read(byte[] arr, int offset, int count) Question 16 The file position indicator of the file pointer can be adjusted to the desired location in the file using which of the following codes? long Seek(long varNum, SeekOrigin position) Private assemblies are used by a single application, offering simplicity, isolation, and easy deployment without affecting other programs. Shared assemblies, stored in the Global Assembly Cache (GAC), allow multiple applications to reuse the same code, ensuring consistency and centralized management. Private assemblies are ideal for standalone applications, while shared assemblies are more suitable for enterprise environments requiring shared functionality. The choice depends on whether isolation or code reuse is prioritized in the project's needs. Create a statement that uses a fileStream parameter to create a StreamWriter object called strWriter. To empty the buffer, add another sentence. Answer: StreamWriter strWriter = new StreamWriter(fileStream); strWriter.Flush(); Make a condition that checks if a FileStream object called myStream is writable. If it is, display a message box that says "File is writable". Otherwise, it should display "File is readable". Answer: if (myStream.CanWrite) { Message.Show("File is writable!") } else { Message.Show("File is readable!"); }

Use Quizgecko on...
Browser
Browser