Download presentation
Presentation is loading. Please wait.
Published byCornelius Harrington Modified over 7 years ago
1
C++ LANGUAGE MULTIPLE CHOICE QUESTION SET-5
2
1. In a linked list: Each link contains a pointer to next link
An array of pointer to the next links Each link contain data Both A and C
3
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
4
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
5
4. A pointer to be a base class can point to object of derived class.
True False Only base class None of these
6
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
7
6. A pure virtual function is a virtual functions that: (Choose all that apply)
Has no body Returns nothing Is used in a child class Take no arguments
8
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
9
8. A friend function can be used to: (Choose all that apply)
Avoid arguments between classes Allow access to class whose source code is unavailable Allow one class to access unrelated class Increase the versatility of an overloaded function
10
9. The keyword friend appears in: (Choose all that apply)
The class allowing access to another class All of these The private section of a class The private section of a class The public section of a class
11
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
12
11 . An assignment operator might be overloaded to: (Choose all that apply)
Help keep track of the number of identical object Assign a separate id onto each object Signal when assignment takes place All of these
13
12. The user must always define the operation of the copy constructor
True False Not always No need to define
14
13. The operation of the assignment operator and that of the copy constructor are: (Choose two options) Similar, except that the copy constructor create the new object Similar, except that the assignment operator copies member data Different , except that the y both copy member data A and C
15
Not just part a whole object data
212. A copy constructor could be defined to copy only part of an object data True False Values Not just part a whole object data
16
15. The lifetime of a variable that is defined as: (Choose all that apply)
Automatic in a member function coincides the lifetime of the function External coincide with the life time of the class Member data of an object coincide with the lifetime of the object Static in a member function coincide with the lifetime of the function
17
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 Partially true Partially false
18
17. A copy constructor is invoked when: (Choose two option)
A function returns by value An argument is passed by value A function returns by reference Both And B
19
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
20
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
21
20. The base class for most stream classes is the ------ class.
IOS IS OS None of these
22
21. Which stream class is to only write on files?
ofstream ifstream fstream iostream
23
22. Which stream class is to only read on files?
of stream if stream stream upstream
24
23. To perform File I/O operations, we must use _____________ header file.
<ifstream> <ofstream> <fstream> One of these
25
24. Which of the following is not a file opening mode ____ .
Ions::ate Ions::concrete Ions::no replace Ions::truncate
26
25. Streams that will be performing both input and output operations must be declared as class iostream stream stdstream Stdiostream
27
26. To create an output stream, we must declare the stream to be of class ___________.
ofstream ifstream iostream None of these
28
27. Which among following is used to open a file in binary mode ?
Ios::app Ios::out Ios::in Ios::binary
29
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);
30
29. Which among following is correct syntax of closing a file in c++ ?
myfile$close(); myfile:close(); myfile.close();
31
30. __________ is return type of is_open() function.
into bolo float char *
32
31. It is not possible to combine two or more file opening mode in open () method.
True False
33
32. By default, all the files are opened in ___________mode
Binary Text Can’t say No idea
34
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
35
34. Offset counted from the current position using?
Ios::curr Ios::cr Ios::cur Ios::current
36
35. Which functions allow changing the location of the get and putting positions?
sg() and sp() sekg() and sekp() gog() and gop() seekg() and seekp()
37
36. Offset counted from the current position using?
Ios::curr Ios::cr Ios::cur Ios::current
38
37. Which among is used for positioning relative to the beginning of a stream?
Ios::start Ios::beg Ios::begin Ios::begining
39
38. 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
40
39. A group of related classes, supplied as a separate product is often called a:
Class library Package Class structure None of the mentioned
41
40. How to find the position at end of fileObject?
fileObject.seekg( 0, ios::end ); fileObject.seekg( 0, ios::end ); fileObject.seekg( 0, ios::end ); fileObject.seekg( 0, ios::end );
42
41. How to get position n bytes forward in fileObject?
fileObject.seekg( ios::cur, n ); fileObject.seekg( n, ios:cur ); fileObject.seekg( n, ios::cur ); fileObject.seekg( ios:cur, n );
43
42. 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 );
44
43. eof() is used to get: Easy code review End of file Debug report
File close
45
44. Name of the streams that are used for:
If stream Of stream F stream All of them
46
45. Some stream work with input and some with output?
True False Partially true Partially false
47
46. 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
48
The insertion operator
47. To write data of the type float, to an object of type ofstream you should use: The insertion operator Seeking() Write() Put()
49
48. Mode bit such as app and ate: (Choose all that apply)
Are defined as ios class Specify ways of opening a file Work with the put() and get() function All of these
50
49. A file pointer is always contains the address of the file.
True False Partially true Partially false
51
50 . 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
52
51. 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
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.