OpenCV Questions and Answers – Object-Oriented

This set of OpenCV Multiple Choice Questions & Answers (MCQs) focuses on “Object-Oriented”.

1. Which class lets application code handle a window and events in an Object-oriented style?
a) CaptureManager
b) EventManagers
c) ImageManager
d) WindowManager
View Answer

Answer: d
Explanation: A WindowManager class lets our application code handle a window and events in an object-oriented style. CaptureManager and WindowManager both are high level interfaces to the I/O (Input/Output) stream. CaptureManager is used to read new frames.

2. Double underscore (__) symbol is used before data members and functions of class to access them as protected members.
a) True
b) False
View Answer

Answer: b
Explanation: Single underscore (_) is used before data members and functions of class to access them as protected members while, double underscore (__) is used before data members and functions to access them as private members.

3. Which of the following are the Access Modifiers types in Python-OpenCV?
a) Public Access Modifier, Protected Access Modifier, Private Access Modifier.
b) Protected Access Modifier, Private Access Modifier, Non-Public Access Modifier.
c) Public Access Modifier, Protected Access Modifier, Semi-private Access Modifier.
d) Public Access Modifier, Semi-Protected Access Modifier, Private Access Modifier.
View Answer

Answer: a
Explanation: There are 3 types of access modifiers types in Python-OpenCV, they are Public Access Modifiers—by default all data members and functions of class are Public, Protected Access Modifier–declared using single underscore (_) symbol, and Private Access Modifier—declared using double underscore(__) symbol.
advertisement
advertisement

4. Which OpenCV function is used to find the framerate of a video?
a) CAP_PROP_FPS
b) CAP_PROP_FRAME_COUNT
c) CAP_PROP_FRAME
d) CAP_PROP_SAR_NUM
View Answer

Answer: a
Explanation: CAP_PROP_FPS function is the OpenCV function that is used to find the framerate of a video, CAP_PROP_FRAME_COUNT is a OpenCV function that is used for Counting the total number of frames in the video. CAP_PROP_SAR_NUM function returns sample aspect ratio of the video.

5. Which of the following statement is TRUE about Camera framerate while using OpenCV library?
a) OpenCV library does not provide any way to get the accurate frame rate for a camera.
b) OpenCV library provides two ways to get the accurate frame rate for a camera.
c) OpenCV library does not take camera as input for calculating framerate
d) OpenCV library only uses Video for calculating the framerate.
View Answer

Answer: a
Explanation: OpenCV (Open Computer Vision) library does not provide any way to get the accurate frame rate for a camera. We cannot get the accurate framerate of direct feed from the camera but we can get accurate frame rate of a video saved from that camera.

6. The Object-Oriented Approach provides more security than the Procedural oriented Approach?
a) It depends on type of program we are creating
b) It depends on the programming language we are using
c) It’s Vice-Versa is TRUE
d) Always True for any programming language and library
View Answer

Answer: d
Explanation: Object-oriented approach provides more security than the Procedural oriented approach as Procedural oriented approach does not have any proper method for hiding data, while object-oriented approach provides data hiding. Accessing properties of data members in object-oriented approach can be controlled by access modifier which makes it more secure.

7. We cannot use object-oriented approach in OpenCV library.
a) True
b) False
View Answer

Answer: b
Explanation: We can use object-oriented approach in OpenCV library. OpenCV supports procedural approach, modular approach as well as object-oriented approach. The object-oriented approach provides both modularity and extensibility.
advertisement

8. Which of the following statement is TRUE, if an abstract class has all the data members and functions are private?
a) No class will be able to access those data members and class’s function but will be able to implement them.
b) Classes which encloses them will be able to implement them.
c) Classes with single inheritance will be able to implement them.
d) No class will be able to implement data members and function of abstract class.
View Answer

Answer: d
Explanation: No class will be able to implement data members and function of abstract class as all the data member and function of the class are private members. The private members of the class will not be inherited or accessed by any other class.

9. Which of access specifier should be used in the parent class so that it’s data members and class’s function can be accessed outside that class?
a) Protected
b) Private
c) Private or Protected
d) Public
View Answer

Answer: d
Explanation: To access the data members and function of class we need to use public access specifier as the access specifier so that all the members of the class can be inherited outside the class and also the member of the class will be available outside the class.
advertisement

10. Which of the access modifier is the most secure modifier?
a) Public Access Modifier
b) Private Access Modifier
c) Protected Access Modifier
d) Semi-Private Access Modifier
View Answer

Answer: b
Explanation: Private access modifier is the most secure access modifier, the members of the class that are declared as private in a class are only accessible within the class only that’s make them more secure than protected and public access modifier.

Sanfoundry Global Education & Learning Series – OpenCV.

To practice all areas of OpenCV, here is complete set of Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.