Question

In: Computer Science

I know the code isn't here nut please answer as much as you can thanks! it...

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 ?

  1. It is a QMap and thus an ItemList object is a QMap itself
  2. It has a QMap, which cannot be accessed outside this class
  3. ItemList uses a heap QMap object
  4. QMap used by ItemList uses Item pointers as keys

Question 2

Which of the following is true about the menu option, Open?

  1. It is only available before the user has entered items manually using Add/A icon
  2. It is only available after the user has entered items manually using Add/A icon
  3. It is available before and after the user has entered items manually
  4. It is no longer available after the user has saved the data in a file

Question 3

What is meant by separating model and view?

  1. Model handles data and view handles how the model is displayed on the screen
  2. View handles data and model may handle how the data is displayed on the screen
  3. Both model and data can handle data/model/logic of the application
  4. Both model and data can handle the data representation on the screen

Question 4

In the given project, how do the view classes access the data in the model classes?

  1. Via inheritance between view and model classes
  2. Via signals and slots
  3. View objects invoke functions on model objects
  4. Model classes are composed of view classes

Question 5

Which of the following is a view class in the given project?

  1. Item
  2. itemList
  3. ItemReader
  4. ItemDialog

Question 6

Why is QActionGroup used in this project?

  1. It is not possible to achieve the desired GUI functionality without QActionGroup
  2. Without it, we need 18 QAction objects
  3. It is necessary to display images on the GUI
  4. It allows grouping of QAction, which can be used to provide same actions in different controls of the GUI

Question 7

Which of the following is a model class in the given project?

  1. MyMainWindow
  2. ItemList
  3. ItemMap
  4. ItemDialog

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?

  1. Each image appears once on the window
  2. Each image appears twice on two different control options on the window
  3. Each image appears thrice on three different control options on the window
  4. Each image appears in four on different control options on the window

Question 9

Which is the correct description of line 83 (*i=*j) in mymainwindow.cpp?

  1. I and j point to the same item object
  2. I and j point to the same heap memory location that has two different item objects
  3. I and j point to two different Item objects with different states
  4. I and j point to two different item objects with the same state

Question 10

Which of the following is incorrect about ItemDialog?

  1. It creates an instance of itself when adding and editing itself
  2. It creates an Item object when the user requests to add an item
  3. It creates an Item object when the user requests to change an item
  4. When the user requests to change, it uses a QInputDialog to get the bar code of the item that the user wants to change

Question 11

Which of the following is incorrect about the project?

  1. It manages a collection of Item objects
  2. It allows the user to read Items from a previous execution of the project
  3. It allows the user to save Items in a comma-separated format
  4. It allows the user to exit the program without saving data

Question 12

What does the icon R stand for?

  1. Read
  2. Retry
  3. Remove
  4. Revise

Question 13

When the user initiates the Save option, which of the following is correct?

  1. It results in a function being executed on an ItemList object, which in turn uses an object of ItemWriter to save
  2. It results in a function being executed on an ItemList object, which in turn uses an object of ItemReader to save
  3. It results in the direct execution of a function on an ItemWriter object
  4. It results in the direct execution of a function on an ItemReader object

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?

  1. It ignores the users request
  2. It ignores the user request but warns the user
  3. It gives the user the option to change the bar code
  4. It allows the user to change the number of items in stock of the existing item

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?

  1. Copy all six images to the project folder
  2. Copy the icons folder to the build project folder
  3. Copy all six images to the project build folder
  4. Add the icons folder to the project as other files

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));

}

Solutions

Expert Solution

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.

===========================================================================


Related Solutions

(Answer as much as you can, I can post the rest if need be, PLEASE SHOW...
(Answer as much as you can, I can post the rest if need be, PLEASE SHOW WORK, DONT USE EXCEL thanks!!) All bonds are semi-annual.  All yield measures are stated as annual percentage rates. 1.         Suppose you buy a 10 year 9% bond that has a YTM of 11%.  What is the price of the bond? 2.         Suppose you buy a 30 year 7% bond that has a YTM of 7.5%.  What is the price of the bond? 3.         What is the YTM of a 7.5...
Can anyone fix this code? The code isn't rounding the answer to the nearest whole number...
Can anyone fix this code? The code isn't rounding the answer to the nearest whole number like 2.345 should be 2 and 2.546 should be 3 but the round() function isn't working as expected. The round() function is rounding 2.546 to 2 which is incorrect since 4 and below should be rounded to 2 and 5 and above should be rounded to 3. Here is the code: #importing xlwt library to write into xls import xlwt from xlwt import Workbook...
I have this mystery code. I dont know what the code does. Can somone please explain...
I have this mystery code. I dont know what the code does. Can somone please explain with examples. (python 3.xx) from typing import Dict, TextIO, Tuple, List def exam(d1: Dict[str, List[int]], d2: Dict[int, int]) -> None: """ *Mystery code* """ for key in d1: value = d1[key] for i in range(len(value)): value[i] = d2[value[i]]   
Here is the question. I understand what the answer is but need to know how you...
Here is the question. I understand what the answer is but need to know how you calculate the PV at 12% in year 5 to equal .567. You have worked in XYZ Corporation for the last five years and have a more optimistic view of the firm's future FCFs. In your personal/professional opinion, XYZ could generate $4 million FCF next year, $4.5 million in year two, $5 million in year three, $5.5 million in year four, $6 million in year...
Please answer as soon as possible -thanks You know from recent news that the U.S. and...
Please answer as soon as possible -thanks You know from recent news that the U.S. and China are having a trade war now as the Trump administration has slapped import duties on $34 billion of Chinese goods, but the USTR wants to impose another $200 billion on a wider range of imports, including for the first time an array of consumer goods. In retaliation, China has targeted the American farmers and ranchers who have in the past benefited from exporting...
Please use java language in an easy way and comment as much as you can! Thanks...
Please use java language in an easy way and comment as much as you can! Thanks 1. A driver class with a main method, which creates instances of various objects (two of each subclass) and adds them as items to an ArrayList named "inventory". A foreach loop should loop through the ArrayList and call the use() method of each item. Define the ArrayList in a way that it only holds elements of the GameItem class and its subclasses. Make proper...
Please use java language in an easy way and comment as much as you can! Thanks...
Please use java language in an easy way and comment as much as you can! Thanks (Write a code question) Write a generic method called "findMin" that takes an array of Comparable objects as a parameter. (Use proper syntax, so that no type checking warnings are generated by the compiler.) The method should search the array and return the index of the smallest value. (Analysis of Algorithms question) Determine the growth function and time complexity (in Big-Oh notation) of the...
Please use java language in an easy way and comment as much as you can! Thanks...
Please use java language in an easy way and comment as much as you can! Thanks (Write a code question) Write a generic method called "findMin" that takes an array of String objects as a parameter. (Use proper syntax, so that no type checking warnings are generated by the compiler.) The method should search the array and return the index of the smallest value.
HI can I please know whats wrong in this 2to1 mux code in VHDL code also...
HI can I please know whats wrong in this 2to1 mux code in VHDL code also please type it out so theres no confusion thank you -- Code your design here library IEEE; use IEEE.std_logic_1164.all; -- entity declaration for testbench entity test mux2 is end test; --architecture Body declaration for 2to1 mux -- component declaration of source entity 2to1 mux component test mux2 is port ( sel : in std_logic ; --select input, A : in std_logic ; --data input...
Please Reply with an answer as soon as possible, will appreciate it so much. Thanks in...
Please Reply with an answer as soon as possible, will appreciate it so much. Thanks in advance. Case Problem: You are a HR assistant manager in a company employing many expatriates from around the world. Your company has selected ‘FutureFunds Pension Planners’ to provide your employees with an international pension plan that takes advantage of tax laws. The plan allows the company to make tax free contributions to the employee pension funds. It also allows Individuals enrolling in the plan...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT