



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Exam questions for a computer science course in the bachelor of engineering (honours) in electronic engineering program at cork institute of technology. The exam covers topics such as polymorphism, constructors and destructors, exception handling, memory allocation, and assembly programming. Students are required to answer questions related to these topics and demonstrate their understanding through examples.
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




(NFQ Level 8)
Read instructions carefully Section A : Answer any TWO questions Section B: Answer any TWO questions Use separate answer books for Sections A and B
Examiners: Prof. G. Hurley Dr. S. Foley Mr. D. O’Donovan Mr. F. O’Reilly
(b) Define a base class called ‘component’ consisting of i), ii) and ii) below: i) Member data:
iii)Public, pure virtual member functions:
(c) Derive a class called ‘resistor’ using (c) as a virtual base class. The class should possess the following member functions: i. A constructor that sets the ‘Device Name’ and passes the ‘Number of Legs’ and ‘Value’ to the base class. ii. Override the OutputVoltage() function to return the result “Current * Resistor”. [6 %] (d) Overload the member function OutputVoltage(void) function to include a bias voltage as a function argument , i.e., double OutputVoltage(float biasVoltage) using the formula “Current * Resistor + biasVoltage”. [5 %]
Q4 (a) Explain how the stack is accessed from an Assembly routine when receiving a function call from a C/C++ program. Examine parameter passing, local variables within the assembly routine and saving register values. [8 marks]
(b) Given the following C++ fragment, write a routine GeneralMaths in x86 assembly which takes as parameters three integers. If the first parameter is 1 , the next two parameters (two and three) are added together, else if the first parameters is 2, the next two parameters (two and three) are multiplied together.
extern GeneralMaths(int X, int Y, int Z); int nOperation, nX, nY; cout << “Which operation Enter 1 for Add, 2 for multiply.” << endl; cin >> nOperation; cout << “Enter the two values << endl; cin >> nX >> nY; cout << “The Result is “ << GeneralMaths(nOperation, nX, nY) << endl; [11 marks] (c) Describe from an architecture or software support basis, three similarities and three differences of the Unix and Windows 2000/XP operating Systems. [6 marks] Total: [25 marks]
Q5 (a) Explain how in an x86 Processor, Software Interrupts can be used to execute useful library functions. Your answer should describe the Vector Table, format of addresses and registers values read or changed. Name and describe one such Interrupt function. [9 marks]
(b) Explain the concept of Memory Segmentation as it applies to the Intel x86 family of micro- processors, including what segments there are, how physical addresses can be calculated and the different registers used to support segmentation. Give one way that segments can be specified/identified in x86 assembly programs. [8 marks]
(c) Describe using diagrams the process/sequence by which messages are passed from the Operating System to individual Windows C++ GUI applications. [8 marks] Total: [25 marks]
Q6 (a) The MFC Application Wizard and ClassWizard allow the acceleration of the writing of Visual C++ Applications. Describe 6 options and choices (6 in total) that they provide and the effects that these choices have, when configuring/designing your application. [8 marks]
(b) Design and provide the code for the program which will check two strings to see if they are the same, as shown below. Describe briefly how the GUI is designed saying what steps need to be done before writing any code. Provide the C++ code to read in the values from the GUI, perform the comparison and output the result. Hint: The CString class has an overloaded equality operator ‘==’ to allow two strings to be directly compared for equality. [9 marks]
(c) Describe the Graphics Subsystem available in Windows Programming. In particular your answer should explain Device Context, Device Drivers, Virtual Screen, Stock Objects, Viewport. [8 marks] Total: [25 marks]