In: Computer Science
I know the code isn't here nut please answer as much as you can thanks!
it is qt creator c++
Question 1
Which of the following is a correct description of ItemList ?
Question 2
Which of the following is true about the menu option, Open?
Question 3
What is meant by separating model and view?
Question 4
In the given project, how do the view classes access the data in the model classes?
Question 5
Which of the following is a view class in the given project?
Question 6
Why is QActionGroup used in this project?
Question 7
Which of the following is a model class in the given project?
Question 8
After making necessary changes so that the images appear on the window (as required for question 2) which of the following is correct after the images are displayed on the window?
Question 9
Which is the correct description of line 83 (*i=*j) in mymainwindow.cpp?
Question 10
Which of the following is incorrect about ItemDialog?
Question 11
Which of the following is incorrect about the project?
Question 12
What does the icon R stand for?
Question 13
When the user initiates the Save option, which of the following is correct?
Question 14
Assume that the user initiates Add option and fills in all the fields using the Add ItemDialog. How does the application handle the data entered by the user, if the bar code provided already exists?
Question 15
Assume you need to implement a function named getDescription() in ItemList that accepts a bar code and returns the description of the item that matches the bar code. Which of the following is the correct implementation of a function getDescription()?
• A. QString ItemList::getDescription(QString b) const{
return list.value(b)->description;
}
• B. QString ItemList::getDescription(QString b) const{
return list.key(b)->description;
}
• C. QString ItemList::getDescription(QString b) const{
return list.value(b)->getDescription();
}
• D. QString ItemList::getDescription(QString b) const{
return list.key(b)->getDescription();
Question 16
Which of the following is incorrect about ItemReader?
• A. ItemReader performs error checking of data read from the file
• B. It can only create Item objects
• C. It is designed to read the data of items from a file
• D. It creates Item objects if the data is formatted in a specific format
Question 17
The output window should display images, which are included in the icons folder. What is needed to be done for the images to appear on the output window without making any changes to the given project?
Question 18
Which of the following is incorrect about isValidBarCode() of Item?
• A. It can be invoked without an object of Item
• B. It can be invoked on an object of Item
• C. It is invoked before a new item is added to the list of applications
• D. It is designed to work with the bar code in its parameter
Question 19
What does the class Item represent?
• A. It represents an expired item in a shop
• B. It represents items in a shop
• C. It represents transactions in a shop
• D. It represents all items that are out of stock in a shop
Question 20
In some cases the main window displays the titles Barcode, Description, Stock and Price when there are no items loaded in the application. How can you ensure that these titles only appear if there are items loaded in the application?
• A. Remove the following statement from mymainwindow.cpp:
textEdit->textCursor().insertText(QString("%1\t%2\t%3\t%4\n").
arg("Barcode", 13).arg("Description", 20) .arg("Stock",5). arg("Price",8));
• B. Move the line of code mentioned in option 1 into the last foreach statement in handleAction() of mymainwindow.cpp
• C. Replace the line of code mentioned in option 1 by the following code:
if (iList.size() >= 1) {
textEdit-> textCursor(). insertText(QString("%1\t%2\t%3\t%4\n"). arg("Barcode", 13).arg("Description", 20). arg("Stock",5).arg("Price",8));
}
• D. Replace the line of code mentioned in option 1 by the following code:
if (iList.toStringList().size() > 0) {
textEdit->textCursor().insertText(QString("%1\t%2\t%3\t%4\n").
arg("Barcode", 13).arg("Description", 20). arg("Stock",5). arg("Price",8));
}
SOLUTION-(1):- (B) It has a QMap, which cannot be accessed outside this class.
SOLUTION-(2):- (C) It is available before and after the user has entered items manually.
SOLUTION-(4):- (C) View objects invoke functions on model objects.
SOLUTION-(6):- (D) It allows grouping of QAction, which can be used to provide same actions in different controls of the GUI.
SOLUTION-(8):- (B) Each image appears twice on two different control options on the window.
SOLUTION-(9):- (D) I and j point to two different item objects with the same state.
SOLUTION-(10):- (D) When the user requests to change, it uses a QInputDialog to get the bar code of the item that the user wants to change.
SOLUTION-(11):- (C) It allows the user to save Items in a comma-separated format.
SOLUTION-(12):- (C) Remove
SOLUTION-(16):- (A) ItemReader performs error checking of data read from the file.
SOLUTION-(17):- (B) Copy the icons folder to the build project folder.
===========================================================================