2025
QUESTIONS AND
ANSWERS
FOR ASSISTANCE CONTACT
EMAIL:
, lOMoARcPSD|31863004
INF2611 Group 1E Exam Preparation Quiz 1
(INF2611_2020_S2-G1E)
1.What are widgets and why are they useful in programming? (2 Points)
The main component for creating a user interface are widgets, such as buttons, menus and scrollbars. They are used for
receiving user input but also to display data and status information. Widgets can also be nested inside another.
2.Name any 3 widgets that you have used in your assignments. (3 Points)
You used among others these widgets:
Clock widget
Calendar
Displaying information in a table
Displaying graphics
3.Explain how you would add a LCD widget and how you can use this to show the system time. (5
Points)
To use the calendar widget you use the methods:
Use the setMode() method, to change the base of the numbers. Available options are Hex, Dec, Oct, Bin.
Use the display() method to display the content as LCD digits.
Use the value() method that can return the numerical value displayed by the LCD Number widget.
For the system clock time displayed, to update automatically, you are required to implement timers.
4.Explain how you would add a calendar widget and how you can use this to display the date
selected in a date edit widget. (3 Points)
To use the calendar widget you use the methods:
Use method selectedDate() that returns the currently selected date.
Use method monthShown() that return the currently displayed month.
Use method yearShown() that returns the currently selected year.
Use method setFirstDayOfWeek() to set the day in the first column.
Use method selectionChanged() when you select a date other than the selected date.(example selecting date by mouse
or keyboard).
You can change various properties in the Calendar Widget such as minimumDate, maximumDate, selectionMode etc.
5.Why is a combobox useful in applications? (1 Point)
Combobox is an input widget, that displays a pop-up list. It forces the user to use only values available in the pop-up list.
Which means it controls user input and ensures validity and accuracy of input.
6.Explain how you can use a combo box in a GUI. (3 Points)
You can use a combo box to display listed items.
You can use it to change an item.
Remove an item
Add an item to the list
Sensitivity: Business - General
, lOMoARcPSD|31863004
INF2611 Group 1E Exam Preparation Quiz 2
(INF2611_2020_S2-G1E)
11,
Use the diagram to answer the question: Explain how you would create a Menu bar with File and
under File three placeholders with Edit, copy and paste. (2 Points)
A default menu bar contains Type Here placeholders. You can replace the Type Here placeholders with text that you want to be
displayed in the menu bar. We will need to click on the Type Here placeholder, and modify the text to "File". When you add a
menu, another Type Here placeholders appears at the bottom, this can be used to add the 3 other entries ; edit, copy and
paste.
22,
Use the diagram to answer the question: Explain how you would you create a shortcut key for the
copy and paste submenus (4). (4 Points)
When editing a text for a menu or sub-menu entry, you can add a ampersand (&) before any character, this character will be
underlined and treated as a shortcut key.
A shortcut key can also be added through the action editor. To assign a shortcut key to any menu entry, open it's action through
the action editor and click the Shortcut Box. Thereafter you can press the key combination you want to assign to the menu
entry. Example, if you press Ctrl + O it will appear in the box, indicating that Ctrl + O is assigned to the menu entry.
33,
How is a menu bar different from a toolbar? (2 Points)
A menu bar consists of several menus, each of which consists of several entries, which in turn may include sub menu entries.
An application can have several toolbars but only one menu bar. A toolbar represents different tools and tasks that a user can
perform in an application.
44,
What is a placeholder? (2 Points)
A placeholder is a character, word or a string of characters that temporarily takes the place of the final data.
You can add separators in a menu entry by double clicking on the Add Separator option in the context menu.
55,
Explain briefly how you would create an action with an icon.. (4 Points)
An action is an operation that the user initiates through the user interface. Tasks such as saving a file, giving a print command,
and aligning text are actions. The action can be initiated by selecting a toolbar button, selecting a menu entry or pressing the
shortcut key. In Qt, an action is created as an object of the QAction class and can be assigned to a menu or a toolbar button for
the user to invoke.
66,
What is a docked widget and why is it useful?(4 Points)
A docked widget is created with the QDockWidget class. A dock widget can be used to create detachable tool palettes or panel widgets.
77,
Name 4 areas that you can place a dock widget. (4 Points)
TopDockWidgetArea
BottomDockWidgetArea
LeftDockWidgetArea
Sensitivity: Business - General
, lOMoARcPSD|31863004
RightDockWidgetArea
88,
What property should you enable to make the dock area movable? (1 Point)
The property that would make a dock widget movable is the DockWidgetMovable property.
99,
What is the purpose of a tab widget?(2 Points)
A tab widget is used to display information in chunks. It enables you to split information into small sections and display each section when the tab
button is selected.
1010,
How do you convert a tab to a widget?(4 Points)
To convert a tab widget into a widget all you need to do is right click on the tab and select the option Morph into. You will receive two options; to
morph into a stacked widget or to morph into a tool box.
1111,
How do you change the style, gradient and colour of a tabbed document?
(4 Points)
To change the style, gradient and colour of a tabbed document all you need to do is right click, choose the option ChangestyleSheet and
from there you can edit the style,gradient and colour as you wish.
1212,
Give 4 reasons why it is important to use Menus in an application. (4 Points)
1313,
Give the necessary steps on how to add a menu to an item. (4 Points)
1414,
Explain how to attach code to menu items? Give an example by referring to an application. (4
Points)
1515,
Explain the different ways that can be used to trigger the same operation.
(4 Points)
1616,
Discuss 3 reasons why menus are required in the development of a database application. (3 Points)
Sensitivity: Business - General