Uploaded by Mohamed Kther

Software Development Midterm (Model Answer)

advertisement
Assiut University
Faculty of Computers and Information
Dept. of Computer Science
Course: Software Development and Professional Practice
[CS381]
3rd Level
Midterm Exam Summer 2020/2021
Allowed Time: 30 minutes , Marks: 25
_____________________________________________________________________________
:‫المستوى‬
:‫االسم بالعربي‬
NOTICE: “The Default Programming Language Used in This Exam is “C#” ”
A) Put True or False
(2 Marks for each point)
1. A using directive tells the compiler where to look for a predefined class that is used in an
app.
True
2. The remainder operator “%” can be used with float operands.
True
3. When the compiler reports a syntax error, the error may not be in the line indicated by the
error message.
True
4. Properties contain get and set accessors that handle the details of returning and modifying
data.
True
5. A value-type variable contains the address of a location in memory where the data referred
to by that variable is stored.
False
6. All the methods defined in a class can not be called without creating an object from that
class.
False
A) Choose the Correct Answer from a,b,c, and d (2 Marks for each point)
1. What is the output of the flowing piece of code?
int result = 2 * 5 + 3 % 2 * 4 / 3;
Console.WriteLine("{0}", result);
(a) 11
(b) 1
(c) syntax error
(d) run-time error
2. What is the output of the flowing piece of code?
if (3 > = 4)
Console.WriteLine("1st");
else
Console.WriteLine("2nd");
(a) 1st
(b) 2nd
(c) syntax error
(d) run-time error
3. To format a piece of the code in Visual Studio, we select the piece of code then press
________.
(a) Ctrl+K, Ctrl+F
(b) Ctrl+F, Ctrl+K
(c) Ctrl+C, Ctrl+V
(d) Ctrl+G
4. Declaring instance variables with access modifier private is known as _____________.
(a) encapsulation (b) information hiding (c) All mentioned
(d) None of mentioned
5. What is the output of the flowing piece of code?
Console.WriteLine("{0:c}", 123);
(a) 123:c
(b) $123.00
(c) 123c
(d) syntax error
6. In a UML class diagram, to indicate that an attribute is private, we would put a __________
before the attribute’s name.
(a) dollar sign
(b) minus sign
(c) plus sign
(d) None of mentioned
7. An example of an auto-implemented property is__________.
(a) public int Age{ get {} set {}}
(b) public string Name{ get; set; }
(c) All mentioned
(d) None of mentioned
End of Exam
Best Wishes!
Prof. Adel Abo El-Magd Sewesy
Download