Question Bank
Which statements is/are true about "assertion" (in Python):
Best way to test precondition violation
Can be disabled in production environments
An example of good defensive programming
Are used for debugging in production environments
Assertions and exceptions are used to provide feedback to the client
Which is the output of the following code?
class A:
def __init__(self):
self.calcI(30)
def calcI(self, i):
self.i = 2 * i;
class B(A):
def __init__(self):
super().__init__()
print("i from B is", self.i)
def calcI(self, i):
self.i = 3 * i;
b = B()Just the __init__ method of class B gets invoked.
The __init__ method of class A gets invoked and it displays “i from B is 0”.
The __init__ method of class A gets invoked and it displays “i from B is 60”.
The __init__ method of class A gets invoked and it displays “i from B is 90”.
Which of the following statements are true regarding the opening modes of a file?
When you open a file for reading, if the file does not exist, an error occurs.
When you open a file for writing, if the file does not exist, an error occurs.
When you open a file for reading, if the file does not exist, the program will open an empty file.
When you open a file for writing, if the file does not exist, a new file is created.
When you open a file for writing, if the file exists, the existing file is overwritten with the new content.
Which of the following statements are true about the following code?
s=0
try:
f = open("test.txt",encoding = ’utf-8’)
for i in f:
s += len(i)
finally:
f.close()
print(s)(This question was not marked as wrong but the commision has not been announced)
the program will print the size of an existing “test.txt” file, in bytes (this should not be correct as we can have the letter â and this is represented as 2 bytes)
the program will crash because i is an integer
the program will crash if the file does not exist
the program will print 0 if the file does not exist
Software verification can imply
automatic static analysis
assesing usefulness and usability of the software in operational situations.
debugging
software inspections
testing to prove error existence
verify that software meets user requirements
State machine diagram shows
system functions.
system response to internal events.
system response to external events.
interactions between objects in the system.
data structures.
interactions between actors and the system.
data flow in the system.
Agile methods in software development imply
Incremental delivery
Customer involvement during development process
Establishing normative processes for team working
Periodic activities to eliminate complexity from the system
Modeling the whole software before writting the code
Select the cases in which only concepts are reused:
Software services
Design patterns
Program libraries
Architectural patterns
Consider the following class diagram. Check the true statements?
An object of type ComputeScience contains a collection of objects of type Student.
Class Questionnaire has a public attribute of type String.
Class ComputerScience has a public operation addStudent(s:Student).
Class ComputerScience has a private operation setSchedule(s:String).
Class Tutor is superclass for the class Masterand.
Class ComputerScience defines a composition of objects of type Questionnaire.
A unidirectional association exists between class ComputerScience and class Tutor.
Class ComputerScience inherits interface Specialization.
Class Tutor defines an aggregate of objects of type Masterand.
Consider the following class diagram.
Which sequence of Java code correctly and completely describes the relations of class Proiect?
class Project extends Student {
private Collection <UMLDiagram> diagrams = new LinkedList<>();
private SourceCode code;
...}class Project {
private Collection <Student> students;
private Collection <UMLDiagram> diagrams = new LinkedList<>();
private SourceCode code;
...}class Project {
private Student student;
private UMLDiagram diagram;
private SourceCode code;
...}class Project {
private Collection <Student> students = new LinkedList<>();
private Collection <UMLDiagram> diagrams;
private SourceCode code;
...}Consider the following class diagram.
Which sequence of Java code correctly and completely describes the relations of class Journal?
class Journal extends OnlineJurnal implements Product {
private Collection <Article> articles;
...}class Journal implements Product {
private Collection <Article> articles = new ArrayList<>();
private OnlineJurnal jurnal;
...}class Journal implements Product {
private Collection <Article> articles = new ArrayList<>();
...}class Journal extends OnlineJurnal {
private Collection <Article> articles = new ArrayList<>();
private Product product;
...}Consider the following class diagram.
Check the complete and correct description of the relations represented on the diagram:
Bidirectional association between classes Project and SourceCode;
composition between classes Project(composite) and UMLDiagram(component);
aggregation between classes Project(aggregate) and Student (component);
generalization between interface IStudent(implemented) and class Student(implements);
realization between classes Student(superclass) and class ScholarshipStudent(subclass).
Bidirectional association between classes Project and SourceCode;
composition between classes Project(composite) and UMLDiagram(component);
aggregation between classes Project(aggregate) and Student(component);
realization between interface IStudent(implemented) and class Student(implements);
generalization between classes Student(superclass) and class ScholarshipStudent(subclass).
Bidirectional association between classes Project and SourceCode;
aggregation between classes Project(aggregate) and UMLDiagram(component);
composition between classes Project(composite) and Student(component);
generalization between interface IStudent(implemented) and class Student(implements);
realization between classes Student(superclass) and class ScholarshipStudent(subclass).
Bidirectional association between classes Project and SourceCode;
composition between classes UMLDiagram(composite) and Project(component);
aggregation between classes Student(aggregate) and Project(component);
realization between interface IStudent(implemented) and class Student (implements);
generalization between classes Student(superclass) and class ScholarshipStudent(subclass).
Consider the following class diagram.
Which sequence of Java code correctly describes the relationship between classes Student and
Project?
class Student extends Project{...}
class Project{...}class Project extends Student{...}
class Student{...}class Project {
private Collection <Student> ...}
class Student{...}class Project {
private Collection <Student> ...}
class Student {
private Project project;
...}class Project {
private Collection <Student> ...}
class Student {
private Collection<Project> projects;
...}Consider the following sequence diagram.
Which operations of class RegistrationControler result from it?
getCourses()
display(offeredCourses)
register(student, selectedCourses)
new Schedule(selectedCourses)
addSchedule(theSchedule)
displayMsg(”OK”)
Consider the following sequence diagram.
Check the classes from which the objects in the previously depicted interactions are instantiated:
RegistrationForm
RegistrtationControler
selectedCourses
current
Student
Schedule
theSchedule
Consider the following robustness diagram.
Which statements are true?
Home page is a boundary object.
GetBooksList can be a persistent object.
DisplayLinks is an object for interfacing with the system.
GetBooksList could be implemented as a method of an entity class.
Catalog is an entity object.
Select the pair of terms to be filled in the spaces of the next statement: “In Essence ‘Checkpoint construction’ game, a checkpoint is a set of ____ to be achieved at a specific point in time in a software engineering endeavor AND is expressed in terms of ____ .”
criteria / activities
components / roles
alphas / activity spaces
criteria / alpha states
alpha states / criteria
Realize the correct mapping between the concept and its definition:
a – 5, b – 1, c – 4, d – 3, e – 2
a – 5, b – 3, c – 4, d – 1, e – 2
a – 2, b – 1, c – 3, d – 4, e – 5
a – 1, b – 2, c – 3, d – 4, e – 5
a – 3, b – 2, c – 4, d – 5, e – 1
Check the methods to avoid introducing faults into the program developing process.
Every class should have a single responsibility
Use regular expressions to validate input values
Avoid deeply nested conditional statements
Logging the interactions of the users with the program.
Replace the body of a method with a more clear algorithm that returns the same result.
Minimize the depth of inheritance hierarchies
Automatically save the user’s data at set intervals.
Identify the aspects of the application that vary and separate them from what stays the same.
Check input values against the range defined by input rules.
Using assertions to check results from an external service.