Home »
MCQs
Kivy MCQs (Multiple-Choice Questions)
Kivy is an open-source Python framework for developing graphical user interfaces and applications. It provides widgets, layouts, properties, events, touch input handling, graphics, and the KV language for building application interfaces.
Kivy MCQs
These Kivy multiple-choice questions cover important concepts such as Kivy applications, widgets, layouts, properties, events, touch events, Canvas, KV language, widget trees, ScreenManager, and application development.
List of Kivy MCQs
Practice these Kivy MCQs with answers and explanations to improve your knowledge of the Kivy framework and prepare for exams, interviews, quizzes, and technical assessments.
1. What is Kivy?
- A Python framework for developing graphical user interfaces and applications
- A relational database system
- A Python testing framework
- A command-line package manager
Answer: A) A Python framework for developing graphical user interfaces and applications
Explanation:
Kivy is an open-source Python framework that provides tools for developing graphical user interfaces and interactive applications.
2. Which module contains the Kivy App class?
kivy.application
kivy.app
kivy.application.core
kivy.main
Answer: B) kivy.app
Explanation:
The Kivy App class is available from the kivy.app module.
3. Which class is commonly inherited when creating a Kivy application?
Application
App
KivyApp
MainApp
Answer: B) App
Explanation:
A Kivy application is commonly created by defining a class that inherits from App.
4. Which method is commonly overridden to create the root widget of a Kivy application?
start()
build()
create()
root()
Answer: B) build()
Explanation:
The build() method is commonly overridden to return the root widget of the application.
5. Which method starts the Kivy application event loop?
start()
run()
execute()
launch()
Answer: B) run()
Explanation:
The run() method starts the application and its event loop.
6. What is a Widget in Kivy?
- A basic building block of a Kivy graphical interface
- A database connection
- A Python package installer
- A configuration file
Answer: A) A basic building block of a Kivy graphical interface
Explanation:
The Widget class is the basic building block for Kivy graphical interfaces. Widgets can receive events, contain children, and have a Canvas for drawing.
7. Which module contains the base Widget class?
kivy.widget
kivy.uix.widget
kivy.ui.widget
kivy.core.widget
Answer: B) kivy.uix.widget
Explanation:
The base Kivy Widget class is provided by the kivy.uix.widget module.
8. Which widget is generally used to display text?
Label
TextView
TextDisplay
Caption
Answer: A) Label
Explanation:
The Kivy Label widget is used to display text in an application interface.
9. Which widget is commonly used to receive text input from a user?
InputBox
TextInput
TextBox
EntryWidget
Answer: B) TextInput
Explanation:
The TextInput widget allows users to enter and edit text.
10. Which widget is commonly used for clickable actions?
Button
ActionLabel
ClickWidget
Command
Answer: A) Button
Explanation:
The Kivy Button widget provides a user interface element that can respond to button events such as pressing and releasing.
11. What is a layout in Kivy?
- A widget that controls the size and position of its children
- A database schema
- A Python source file
- A graphics driver
Answer: A) A widget that controls the size and position of its children
Explanation:
Kivy layouts organize child widgets by controlling their size and position.
12. Which layout arranges widgets horizontally or vertically?
BoxLayout
GridLayout
AnchorLayout
FloatLayout
Answer: A) BoxLayout
Explanation:
BoxLayout arranges its children adjacent to one another either vertically or horizontally.
13. Which property determines the orientation of a BoxLayout?
direction
orientation
alignment
axis
Answer: B) orientation
Explanation:
The orientation property determines whether a BoxLayout arranges its children horizontally or vertically.
14. Which layout arranges widgets in a grid?
GridLayout
TableLayout
MatrixLayout
GridBox
Answer: A) GridLayout
Explanation:
GridLayout organizes children in a grid and requires at least one grid dimension to determine how the children are arranged.
15. Which layout allows children to be positioned using absolute or relative coordinates?
FloatLayout
BoxLayout
GridLayout
StackLayout
Answer: A) FloatLayout
Explanation:
FloatLayout allows children to be positioned at arbitrary locations and sizes using properties such as pos, size, pos_hint, and size_hint.
16. Which layout is mainly concerned with positioning children relative to its borders?
AnchorLayout
BoxLayout
GridLayout
StackLayout
Answer: A) AnchorLayout
Explanation:
AnchorLayout positions its children relative to the edges or center of the layout.
17. Which method adds a widget as a child of another widget?
add_widget()
insert_widget()
append_widget()
attach_widget()
Answer: A) add_widget()
Explanation:
The add_widget() method adds a widget to the widget tree as a child.
18. Which method removes a specific child widget?
delete_widget()
remove_widget()
detach_widget()
drop_widget()
Answer: B) remove_widget()
Explanation:
The remove_widget() method removes a specified child from the widget tree.
19. Which method removes all children from a widget?
remove_all()
clear_widgets()
delete_children()
clear_children()
Answer: B) clear_widgets()
Explanation:
The clear_widgets() method removes all child widgets from a widget.
20. Which attribute contains the children of a Kivy widget?
children
widgets
child_list
subwidgets
Answer: A) children
Explanation:
The children property contains the child widgets belonging to a widget.
21. What is the widget tree in Kivy?
- A hierarchical structure of widgets and their children
- A list of Python packages
- A database index
- A graphics shader program
Answer: A) A hierarchical structure of widgets and their children
Explanation:
Kivy organizes widgets in a tree structure where a root widget can contain children, which can themselves contain other widgets.
22. What is the purpose of the size_hint property?
- To control how a widget's size is determined relative to its parent layout
- To change the font size
- To change the widget's color
- To define a widget's text
Answer: A) To control how a widget's size is determined relative to its parent layout
Explanation:
size_hint allows layouts to determine a child's size proportionally relative to the available space.
23. Which property helps position a widget relative to its parent layout?
pos_hint
position_hinting
relative_pos
layout_hint
Answer: A) pos_hint
Explanation:
The pos_hint property provides hints to layouts about how a widget should be positioned.
24. What is the Kivy Property system used for?
- Managing observable widget values and dispatching change events
- Installing Kivy packages
- Creating Python modules
- Compiling KV files into machine code
Answer: A) Managing observable widget values and dispatching change events
Explanation:
Kivy properties provide observable values and can automatically dispatch events when their values change.
25. Which Kivy property is designed to hold a string value?
StringProperty
TextProperty
CharProperty
StringValue
Answer: A) StringProperty
Explanation:
StringProperty is used for observable string values in Kivy widgets and custom classes.
26. Which Kivy property is used for Boolean values?
BoolProperty
BooleanValue
BooleanPropertyType
FlagProperty
Answer: A) BoolProperty
Explanation:
BoolProperty represents observable Boolean values.
27. Which Kivy property is commonly used for floating-point values?
FloatProperty
DecimalProperty
RealProperty
DoubleProperty
Answer: A) FloatProperty
Explanation:
FloatProperty is used to define observable floating-point values.
28. Which Kivy property is suitable for storing a list?
ListProperty
ArrayProperty
SequenceProperty
CollectionProperty
Answer: A) ListProperty
Explanation:
ListProperty provides an observable property for list values.
29. Which method can be used to bind a callback to a Kivy property?
bind()
attach()
listen()
observe()
Answer: A) bind()
Explanation:
The bind() method can attach a callback to a property or event so that the callback can respond when the value changes.
30. What is an event in Kivy?
- An occurrence to which application code can respond
- A Python package
- A layout type
- A database transaction
Answer: A) An occurrence to which application code can respond
Explanation:
Kivy uses an event-driven architecture in which widgets can react to events such as property changes, touch input, and widget-specific events.
31. Which method is commonly used to define what happens when a touch begins on a widget?
on_touch_down()
touch_start()
on_click_down()
touch_begin()
Answer: A) on_touch_down()
Explanation:
on_touch_down() is part of Kivy's touch event handling and is called when a touch begins.
32. Which method handles the movement of an active touch?
on_touch_move()
touch_move()
on_move_touch()
touch_update()
Answer: A) on_touch_move()
Explanation:
on_touch_move() is used to handle movement of an active touch event.
33. Which method handles the end of a touch event?
on_touch_up()
touch_end()
on_release_touch()
finish_touch()
Answer: A) on_touch_up()
Explanation:
on_touch_up() is called when a touch event ends.
34. What does the Kivy Canvas provide?
- Graphics instructions used to draw a widget
- A database connection
- A Python compiler
- A layout manager
Answer: A) Graphics instructions used to draw a widget
Explanation:
Each Kivy widget has a Canvas that can contain graphics instructions used to create its visual representation.
35. Which module provides graphics classes such as Color and Rectangle?
kivy.graphics
kivy.canvas
kivy.draw
kivy.render
Answer: A) kivy.graphics
Explanation:
Kivy's kivy.graphics module provides graphics instructions such as Color, Rectangle, and Line.
36. What is the purpose of the KV language?
- To declaratively define widget trees, properties, and event bindings
- To replace Python completely
- To manage databases
- To compile Kivy applications into C++
Answer: A) To declaratively define widget trees, properties, and event bindings
Explanation:
The KV language allows developers to describe widget trees, property relationships, event bindings, and parts of the user interface declaratively.
37. What is the usual file extension for a Kivy KV language file?
.kv
.kivy
.ui
.kvl
Answer: A) .kv
Explanation:
Kivy uses files with the .kv extension for KV language source.
38. If an App class is named MyApp, which KV filename does Kivy look for by naming convention?
my.kv
myapp.kv
MyApp.kv
app.kv
Answer: A) my.kv
Explanation:
By convention, Kivy looks for a KV file based on the App class name in lowercase, with the trailing App removed. Therefore, MyApp maps to my.kv.
39. Which Kivy class can be used to load KV source programmatically?
Builder
KVLoader
LanguageBuilder
KivyBuilder
Answer: A) Builder
Explanation:
The Kivy Builder can load KV source using methods such as load_file() and load_string().
40. In KV language, what does root refer to?
- The base widget or template in the current KV rule
- The operating system root directory
- The Python interpreter
- The first imported module
Answer: A) The base widget or template in the current KV rule
Explanation:
In KV language, root refers to the base widget or template associated with the current rule.
41. In KV language, what does self refer to?
- The current widget
- The application root only
- The Python module
- The parent layout only
Answer: A) The current widget
Explanation:
Within KV language, self refers to the current widget.
42. In KV language, what does app refer to?
- The current Kivy App instance
- The current widget only
- The root window object only
- The KV Builder object
Answer: A) The current Kivy App instance
Explanation:
The special KV keyword app refers to the instance of the current Kivy application.
43. What is the purpose of an id in KV language?
- To reference a widget within the scope of a KV rule
- To assign a database primary key
- To create a Python package
- To define a class inheritance relationship
Answer: A) To reference a widget within the scope of a KV rule
Explanation:
An id gives a widget a reference name that can be used within the scope of the relevant KV rule.
44. How can a widget with the id button1 commonly be accessed from its KV-defined widget class in Python?
self.ids.button1
self.widget.button1
self.kv.button1
self.children.button1
Answer: A) self.ids.button1
Explanation:
Kivy collects widgets with KV ids into an ids dictionary-like property, allowing access such as self.ids.button1.
45. How are event bindings commonly written in KV language?
- Using the
on_ event followed by a colon
- Using the
event() function only
- Using SQL-style triggers
- Using the
bind: keyword only
Answer: A) Using the on_ event followed by a colon
Explanation:
KV language supports event bindings using syntax such as on_press: or on_text: followed by an expression or callback.
46. Which Kivy class is used to manage multiple screens?
ScreenManager
ScreenController
MultiScreen
PageManager
Answer: A) ScreenManager
Explanation:
ScreenManager is used to manage a collection of screens and control which screen is currently displayed.
47. What does the current property of ScreenManager represent?
- The name of the currently displayed screen
- The number of screens created
- The previous screen's name only
- The screen transition duration
Answer: A) The name of the currently displayed screen
Explanation:
The current property identifies the currently displayed screen by its name.
48. Which class is commonly used to represent an individual screen in a Kivy application?
Screen
Page
View
WindowScreen
Answer: A) Screen
Explanation:
The Kivy Screen class represents an individual screen that can be managed by a ScreenManager.
49. Which property represents a widget's position in Kivy?
pos
position
location
coordinate
Answer: A) pos
Explanation:
The pos property represents the position of a widget in the window coordinate system.
50. Which statement best describes Kivy?
- A Python framework providing widgets, layouts, events, graphics, properties, and KV language for application development
- A Python-only database management system
- A framework exclusively for command-line applications
- A library used only for numerical calculations
Answer: A) A Python framework providing widgets, layouts, events, graphics, properties, and KV language for application development
Explanation:
Kivy provides a complete framework for developing interactive applications with widgets, layouts, an event system, observable properties, graphics, touch input handling, and the declarative KV language.
Advertisement
Advertisement