C ++ MULTIPLE CHOICE QUESTION

Slides:



Advertisements
Similar presentations
 2006 Pearson Education, Inc. All rights reserved File Processing.
Advertisements

計算機概論實習 Files and Streams C++ views file as sequence of bytes Ends with end-of-file marker n-1 end-of-file marker 67 This is.
Copyright © 2012 Pearson Education, Inc. Chapter 12: Advanced File Operations.
CS-212 C++ I/O Dick Steflik. C++ I/O Modeled after UNIX’s concept of a “stream” –conceptionally a stream is a continuous flow of characters/bytes from.
 2006 Pearson Education, Inc. All rights reserved File Processing.
17 File Processing. OBJECTIVES In this chapter you will learn:  To create, read, write and update files.  Sequential file processing.  Random-access.
Chapter 15.
Chapter 8: I/O Streams and Data Files. In this chapter, you will learn about: – I/O file stream objects and functions – Reading and writing character-based.
1 File I/O In C++, I/O occurs in streams. A stream is a sequence of bytes Each I/O device (e.g. keyboard, mouse, monitor, hard disk, printer, etc.) receives.
Streams, Files. 2 Stream Stream is a sequence of bytes Input stream In input operations, the bytes are transferred from a device to the main memory Output.
Stream Handling Streams - means flow of data to and from program variables. - We declare the variables in our C++ for holding data temporarily in the memory.
Darbas su failais Arnas Terekas IT 1gr. Vilniaus universitetas Matematikos ir informatikos fakultetas.
CSIS 123A Lecture 8 Streams & File IO Glenn Stevenson CSIS 113A MSJC.
C++ for Engineers and Scientists Second Edition Chapter 8 I/O File Streams and Data Files.
File I/O ifstreams and ofstreams Sections 11.1 &
Chapter 9 I/O Streams and Data Files
FILE HANDLING IN C++.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 12: Advanced File Operations.
STL List // constructing lists #include int main () { // constructors used in the same order as described above: std::list first; // empty list of ints.
Monday, Mar 31, 2003Kate Gregory with material from Deitel and Deitel Week 12 Labs 4 and 5 are back File IO Looking ahead to the final.
File I/O 1 ifstreams and ofstreams Sections 11.1 & 11.2.
An Introduction to Programming with C++ Sixth Edition Chapter 14 Sequential Access Files.
C++ FILE I/O.
FILE I/O IN C++. Using Input/Output Files A computer file  is stored on a secondary storage device (e.g., disk);  is permanent;  can be used to provide.
C++ Programming: chapter 6 – iostream 2014, Spring Pusan National University Ki-Joune Li 1.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 13 File Input and.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 12 Advanced File Operations.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
File Handling. Read data from file and display it on screen #include int main() { /* fin object is created with parameterzied constructor */ ifstream.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 1 due Friday, 7pm. RAD due next Friday. Presentations week 6. Today: –More details on functions,
1 CSC241: Object Oriented Programming Lecture No 32.
Input/Output CSci 588: Data Structures, Algorithms and Software Design Fall 2011 All material not from online sources copyright © Travis Desell, 2011
C++ Programming: chapter 6 – iostream 2015, Spring Pusan National University Ki-Joune Li 1.
Declaring fstream Objects An istream object named cin connects program and keyboard An ostream object named cout connects the program and the screen These.
Exploring the C++ Stream Library Copyright 2006 Oxford Consulting, Ltd1 February IO Streams  IOStreams are part of the Standard C++ library.
Learners Support Publications Working with Files.
Lecture 14 Arguments, Classes and Files. Arguments.
FILE HANDLING(WORKING WITH FILES) FILE- A file is a collection of related data stored in a particular area on the disk. STREAMS- interface between the.
Binary Files. Text Files vs. Binary Files Text files: A way to store data in a secondary storage device using Text representation (e.g., ASCII characters)
CSE 232: Moving Data Within a C++ Program Moving Data Within a C++ Program Input –Getting data from the command line (we’ve looked at this) –Getting data.
Ms N Nashandi Dr SH Nggada 2016/01/03Ms N Nashandi and Dr SH Nggada1 Week 6 -File input and output in C++
Programming II I/O Streams and Data Files 1(c) Asma AlOsaimi.
CS212: Object Oriented Analysis and Design
Chapter 14: Sequential Access Files
Programming with ANSI C ++
17 File Processing.
File Processing in C++ Data is stored in files so that it may be retrieved for processing when needed.
What is a File? A file is a collection on information, usually stored on a computer’s disk. Information can be saved to files and then later reused.
Copyright © 2003 Pearson Education, Inc.
CISC/CMPE320 - Prof. McLeod
FILE HANDLING IN C++.
17 File Processing.
17 File Processing.
آشنایی با ساختارها و کار با فایلها
files Dr. Bhargavi Goswami Department of Computer Science
Today’s Lecture I/O Streams Tools for File I/O
C++ FileIO pepper.
Topics Input and Output Streams More Detailed Error Testing
Chapter 12: Advanced File Operations.
File Processing in C++ Data is stored in files so that it may be retrieved for processing when needed.
CISC/CMPE320 - Prof. McLeod
CPS120: Introduction to Computer Science
C++ Programming: chapter 6 – iostream
Data File Handling RITIKA SHARMA.
Reading from and Writing to Files
C++ Programming Lecture 8 File Processing
C++ for Engineers and Scientists Second Edition
File I/O in C++ II.
Reading from and Writing to Files
SPL – PS3 C++ Classes.
Presentation transcript:

C ++ MULTIPLE CHOICE QUESTION

Check your Knowledge Press to Start www.prolearninghub.com

1. In a linked list: 1) Each link contains a pointer to next link 2) Each link contains data 3) An array of pointer to the next links 4) The link is stored in a array 2;4 1;2 1;3 3;4 www.prolearninghub.com

2. If you wanted to sort so many large objects or structure, it would be most efficient to: Place them in a array and sort the array Place pointers to them and then sort the array Placed them in a link list and sort the link list Place reference to them in an array and then sort them www.prolearninghub.com

3. Virtual function allows you to: Create an array of type pointer-to-base class that can hold pointer to derived class Create function that have no body Group the object of different class Use the same function call to execute the member function from different class www.prolearninghub.com

4. A pointer to be a base class can point to object of derived class. True False www.prolearninghub.com

Late binding or dynamic binding 5. Deciding after a program start to execute what function will be executed by a particular function call statement, is called Late binding Dynamic binding Late binding or dynamic binding None of these www.prolearninghub.com

6. A pure virtual function is a virtual functions that: (Choose all that apply) 1) Has no body 2) Is used in a base class 3) Returns nothing 4) Take no arguments 2;4 1;4 2;3 1;2 www.prolearninghub.com

7. A virtual base function is useful when: Different base function in base and derived classes have the same name There are multiple paths from the one derived class to another The identification of a function in base class is ambiguous It make sense to use base class with no body www.prolearninghub.com

8. A friend function can be used to: (Choose all that apply) 1) Avoid arguments between classes 2) Allow access to class whose source code is unavailable 3) Allow one class to access unrelated class 4) Increase the versatility of an overloaded function 1;2 1;3 3;4 2;4 www.prolearninghub.com

9. The keyword friend does not appear in: (Choose all that apply) The class allowing access to another class The class desiring access to another class The private section of a class The public section of a class www.prolearninghub.com

10. A static function: Should be called when an object is destroyed Is closely connected with an individual object for a class Can be called using the class name and function name Is used when a dummy object must be created www.prolearninghub.com

11. An assignment operator can not be overloaded to: Help keep track of the number of identical object Assign a separate id onto each object Ensure that all member data is copied exactly Signal when assignment takes place www.prolearninghub.com

12. The user must always define the operation of the copy constructor True False www.prolearninghub.com

13. The operation of the assignment operator and that of the copy constructor are: (Choose two options) 1) Similar, except that the copy constructor create the new object 2) Similar, except that the assignment operator copies member data 3) Different, except that they both create a new object 4) Different , except that they both copy member data 1;2 1;4 2;3 3;4 www.prolearninghub.com

14. A copy constructor could be defined to copy only part of an object data True False www.prolearninghub.com

15. The lifetime of a variable that is defined as: (Choose all that apply) 1) Automatic in a member function coincides the lifetime of the function 2) Member data of an object coincide with the lifetime of the object 3) External coincide with the life time of the class 4) Static in a member function coincide with the lifetime of the function 1;4 1;2 2;3 3;4 www.prolearninghub.com

16. There is no problem with returning the value of a variable defined as automatic within a member function so long as it is returned by the value. True False www.prolearninghub.com

17. A copy constructor is invoked when: 1) A function returns by reference 2) A function returns by value 3) An argument is passes reference 4) An argument is passed by value 2;4 1;4 2;3 1;3 www.prolearninghub.com

18. What does this pointer point to? The object of the function whose using its member The current occupying object Both a and b None of these www.prolearninghub.com

The flow of function through the function 19. A C++ stream is: The flow of function through the function The flow of data from one place to another A file None of these www.prolearninghub.com

20. The base class for most stream classes is the ____class. IOS IS OS None of these www.prolearninghub.com

21. Which stream class is to only write on files? ofstream ifstream fstream iostream www.prolearninghub.com

22. Which stream class is to only read on files? of stream if stream stream upstream www.prolearninghub.com

23. To perform File I/O operations, we must use _________ header file. <ifstream> <ofstream> <fstream> Any of these www.prolearninghub.com

24. Which of the following is not a file opening mode ____ . Ions::ate Ions::concrete Ions::no replace Ions::truncate www.prolearninghub.com

25. Streams that will be performing both input and output operations must be declared as class _______. iostream stream stdstream Stdiostream www.prolearninghub.com

26. To create an output stream, we must declare the stream to be of class ___________. ofstream ifstream iostream None of these www.prolearninghub.com

27. Which among following is used to open a file in binary mode ? Ios::app Ios::out Ios::in Ios::binary www.prolearninghub.com

28. Which is correct syntax? myfile:open ("example.bin", ios::out); myfile.open ("example.bin", ios::out); myfile::open ("example.bin", ios::out); myfile.open ("example.bin", ios:out); www.prolearninghub.com

29. Which among following is correct syntax of closing a file in C++ ? myfile$close(); myfile@close(); myfile:close(); myfile.close(); www.prolearninghub.com

30. __________ is return type of is_open() function. into bolo float char * www.prolearninghub.com

31. It is not possible to combine two or more file opening mode in open () method. True False www.prolearninghub.com

32. By default, all the files are opened in ___________mode Binary Text Can’t say No idea www.prolearninghub.com

33. What is use of elf()? Returns true if a file open for reading has reached the next character. Returns true if a file open for reading has reached the next word. Returns true if a file open for reading has reached the end Returns true if a file open for reading has reached the middle www.prolearninghub.com

34. Which functions allow changing the location of the get and putting positions? sg() and sp() sekg() and sekp() gog() and gop() seekg() and seekp() www.prolearninghub.com

35. Offset counted from the current position using? Ios::curr Ios::cr Ios::cur Ios::current www.prolearninghub.com

36. Which among is used for positioning relative to the beginning of a stream? Ios::start Ios::beg Ios::begin Ios::begining www.prolearninghub.com

37. Which is among following is used to Open a file for output and move the read/write control to the end of the file? Ios::ate Ios::ann Ios::at Ios::end www.prolearninghub.com

38. Which is correct syntax for, position n bytes back from end of fileObject ? fileObject.seekg(ios::end, n); fileObject.seekg(n, ios:end ); fileObject.seekg(n, ios::end ); fileObject.seekg(ios:end, n); www.prolearninghub.com

39. Which stream class is used to both read and write on files ifstream fstream ofstream iostream www.prolearninghub.com

40. How to get position to the nth byte of fileObject? fileObject.seekg( 'filename',n ); fileObject.seekg( n, 'filename' ); fileObject.seekg( n ); fileObject.seekg( n, ios::app ); www.prolearninghub.com

41. eof() is used to get: Easy code review End of file Debug report File close www.prolearninghub.com

42. Name of the streams that are used for: If stream Of stream F stream All of them www.prolearninghub.com

43. Some stream work with input and some with output? True False www.prolearninghub.com

44. We can output a text on an object class of ofstream using the insertion operator because: The ofstream class is the stream The insertion operator is work with all classes We are actually outputting to cout The insertion operator is overloaded in ofstream www.prolearninghub.com

The insertion operator 45. To write data of the type float, to an object of type ofstream you should use: The insertion operator Seeking() Write() Put() www.prolearninghub.com

46. Mode bit such as app and ate: (Choose all that apply) 1) Are defined as ios class 2) Can specify if the file is open for read or write 3) Work with the put() and get() function 4) Specify ways of opening a file 2;3;4 1;3;4 1;4 1;2;3 www.prolearninghub.com

47. A file pointer is always contains the address of the file. False True www.prolearninghub.com

48. The statement f1.write((char*)^obj1, sizeof(obj1)); Writes the member function of obj1 to f1 Writes the date in obj1 to f1 Writes the member function and data of obj1 to f1 Writes the address if obj1 to f1 www.prolearninghub.com

49. Redirection redirects: A stream from a file to screen A file from a device to a stream A device from a stream to screen The screen from a device to stream www.prolearninghub.com

50. The printer can access using the predefined filename____? PRN PLC Can be both None of these www.prolearninghub.com

The Results