Download presentation
Presentation is loading. Please wait.
1
C ++ MULTIPLE CHOICE QUESTION
2
Check your Knowledge Press to Start
3
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
4
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
5
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
6
4. A pointer to be a base class can point to object of derived class.
True False
7
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
8
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
9
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
10
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
11
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
12
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
13
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
14
12. The user must always define the operation of the copy constructor
True False
15
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
16
14. A copy constructor could be defined to copy only part of an object data
True False
17
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
18
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
19
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
20
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
21
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
22
20. The base class for most stream classes is the ____class.
IOS IS OS None of these
23
21. Which stream class is to only write on files?
ofstream ifstream fstream iostream
24
22. Which stream class is to only read on files?
of stream if stream stream upstream
25
23. To perform File I/O operations, we must use _________ header file.
<ifstream> <ofstream> <fstream> Any of these
26
24. Which of the following is not a file opening mode ____ .
Ions::ate Ions::concrete Ions::no replace Ions::truncate
27
25. Streams that will be performing both input and output operations must be declared as class _______. iostream stream stdstream Stdiostream
28
26. To create an output stream, we must declare the stream to be of class ___________.
ofstream ifstream iostream None of these
29
27. Which among following is used to open a file in binary mode ?
Ios::app Ios::out Ios::in Ios::binary
30
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);
31
29. Which among following is correct syntax of closing a file in C++ ?
myfile$close(); myfile:close(); myfile.close();
32
30. __________ is return type of is_open() function.
into bolo float char *
33
31. It is not possible to combine two or more file opening mode in open () method.
True False
34
32. By default, all the files are opened in ___________mode
Binary Text Can’t say No idea
35
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
36
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()
37
35. Offset counted from the current position using?
Ios::curr Ios::cr Ios::cur Ios::current
38
36. Which among is used for positioning relative to the beginning of a stream?
Ios::start Ios::beg Ios::begin Ios::begining
39
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
40
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);
41
39. Which stream class is used to both read and write on files
ifstream fstream ofstream iostream
42
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 );
43
41. eof() is used to get: Easy code review End of file Debug report
File close
44
42. Name of the streams that are used for:
If stream Of stream F stream All of them
45
43. Some stream work with input and some with output?
True False
46
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
47
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()
48
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
49
47. A file pointer is always contains the address of the file.
False True
50
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
51
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
52
50. The printer can access using the predefined filename____?
PRN PLC Can be both None of these
53
The Results
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.