100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

COS3711 EXAM PACK 2023

Puntuación
5.0
(1)
Vendido
2
Páginas
16
Grado
A+
Subido en
17-10-2023
Escrito en
2023/2024

COS3711 EXAM PACK 2023

Institución
Grado










Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
17 de octubre de 2023
Número de páginas
16
Escrito en
2023/2024
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

COS3711
EXAM
PACK
2023
FOR AND QUERIES & EXAM HELP CONTACT:


,Exam 2009 Q & A
What we what to do with this thread is work through the 2009 Exam.

So I'll keep the thread up to date with everyone's help.
And please don't assume the answers are correct, I'm also a student..

1.1 Identify and motivate a design pattern that can be used to read such an XML
document and to create appropriate reward objects when the player wishes to continue the game.
[2]
Serializer pattern (to isolate the code to read from the file) followed by the AbstractFactory
pattern (to create the different types of objects) //See the post from rezrovs

1.2 Identify and motivate a design pattern that can be used to structure these three rewards
in a class hierarchy using the information given in the XML document. Draw a UML diagram
with appropriate
classes of this design pattern. [8]
Composite, because we're representing classes that are composed of other classes. Both Reward
and TreasureChest
look to be composite objects and Lamp, MagicMat and TreasureChest are components
See post from Kyle

2.1 Explain briefly the function of the FileVisitor and CodeVisitor classes which follow the
Visitor pattern.[2]
Given a path to a directory, FileVisitor traverses all the files and subdirectories in that path.
CodeVisitor open each file and searches for “#include” lines of text in each file.

2.2 Rewrite CodeVisitor so that the FileVisitor and CodeVisitor classes are completely
decoupled so that CodeVisitor can exist independently of FileVisitor. [5]
Language: C++
Class CodeVisitor: public QObject{
Q_OBJECT
public:
CodeVisitor(QString filter “-h”, bool recursive = true);
void getNumFiles() const;
QString getResultString() const;

public slots:
void processFile(QString filename);

private:
int m_NumFiles;
QStringList m_Result;
};

connect the FileVisitor signal to CodeVisitor slot
Language: C++ (QT)
[...]
FileVisitor fv(filter, recursive, symlink);
CodeVisitor cv(filter, recursive);

connect (fv, SIGNAL(foundFile(QString)), cv, SLOT(processFile(QString)));

[...]

, 2.3 State how the changes made in Question 2.2 would limit the features of the FileVisitor
and CodeVisitor classes.[2]
CodeVisitor is limited because with the changes the recursive directory visiting structure that
was inherited from FileVisitor is lost and therefore a CodeVisitor object can, at best, only visit
files in the working directory. Any recursive directory/file visiting will have to be re-
implemented in CodeVisitor.

FileVisitor is limited because the client code can only plug a FileVisitor object where it is
expected and not a derived subclass object through polymorphism, which would probably do
more that emitting a signal to indicate that a file has been found. In this particular case,
FileVisitor::processFile() does nothing special except emitting a signal whereas
CodeVisitor::processFile does something 'interesting'.

2.4 Once the FileVisitor and CodeVisitor classes are decoupled write the necessary code
to utilise these two classes to achieve a file processing task. [3]
Answer:

2.5 Using the decoupled FileVisitor and CodeVisitor classes implement the Strategy pattern
so that different file processing techniques can be included as different strategies. Rewrite
CodeVisitor to implement
the Strategy pattern. Include both header and cpp files.[5]
Answer:

2.6Using the solution given to Question 2.5 implement a concrete strategy to check if the file
names
end with a .txt extension. Include both header and cpp files.[5]
Answer:

3.1 Describe the relationship between a framework and an Application Programmers’
Interface (API)
referring to Qt4. [2]
A Framework is a large collection of general-purpose classes and conventions designed to
improve the consistency of
design. A Framework has a well-documented public Application Programmers’
Interface(API). An API is a description
of public functions, classes, and interfaces in a library.

3.2 One aspect of C++ that makes it very powerful is its ability to package code in several
different ways,
which Ezust refer to as containers of code. One example of such a container of code is a class
that is a collection of
functions and data members, and descriptions of its lifecycle management. Identify and describe
three other terms that are
used to describe containers of code. [6]
(p.171)
namespace – A collection of declarations and definitions, of classes, functions and static
members, perhaps spanning multiple files.
header file(.h) – Class definitions, template definitions, function declaration, inline definitions,
static object definitions.
source code module(.cpp) – Function definitions, static object definitions.
library(.lib) – An indexed collection of object file linked together.
$2.50
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Reseñas de compradores verificados

Se muestran los comentarios
1 año hace

5.0

1 reseñas

5
1
4
0
3
0
2
0
1
0
Reseñas confiables sobre Stuvia

Todas las reseñas las realizan usuarios reales de Stuvia después de compras verificadas.

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
examexpert01 Chamberlain College Nursing
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
195
Miembro desde
2 año
Número de seguidores
111
Documentos
937
Última venta
1 mes hace

3.3

21 reseñas

5
9
4
0
3
6
2
1
1
5

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes