P h i l

advertisement
Philadelphia University
Lecturer
: Mrs. Eman Alnaji
Coordinator : Miss. Reem AlQaqa
Internal Examiner: Dr. Nameer Al Emam
Visual Programming (761220)
Date: 5-1-2015
Second Exam
I
Faculty of Information Technology
Department of CIS
Examination Paper
First Semester of 2014-2015
Time: 60 minutes
Information for Candidates
1. This examination paper contains four questions, totaling 20 marks
2. The marks for parts of questions are shown in square brackets.
Advice to Candidates
1. You should attempt all questions.
2. You should write your answers clearly.
I. Basic concepts
Objective: The aim of the questions in this part is to evaluate your knowledge and skills concerning with the basic
concepts of windows programming using .NET environment
Question1: Choose the correct answer of the following:
[5 Marks, 1 Mark each]
1. Using one of the following controls force the user to single selection (i.e. The user cannot select more
than one item)
A) ListBox
B) ListView
C) ComboBox
D) All of the above
2. The property that specifies how a link appears when the mouse is placed over it:
A) LinkBehavior
B) LinkVisited
C) LinkColor
D) LinkArea
3. In ComboBox, which value of property DropDownStyle makes the ComboBox editable (i.e. can be
written in it)?
A) Simple
B) DropDown
C) DropDownList
D) A + B
4. In the tree displayed in the image below, to retrieve the text of node (Node2), you will use the
sentence:
A)
B)
C)
D)
treeView1.Nodes[0].Nodes[2].text
treeView1.Nodes.Nodes[1].text
treeView1.Nodes[0].Nodes[1].text
treeView1.Nodes[2].text
1
5. To clear a listBox control, you must write:
A) listBox1.Clear();
B) listBox1.Items.Clear();
C) listBox1.SelectedItem.Clear();
D) None of the above
II. Familiar Problem Solving
Objective: The aim of the questions in this part is to evaluate that the student has some basic knowledge of the
key aspects of the lecture material and can attempt to solve familiar problems.
Question2: Create the following form that adds items to the listBox by checking on them in the
checkedlistbox, and removes them, when they are unchecked.
[Total: 4 Marks]
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (e.NewValue == CheckState.Checked)
listBox1.Items.Add(checkedListBox1.SelectedItem);
else
listBox1.Items.Remove(checkedListBox1.SelectedItem);
}
2
Question3: Create the following form as an MDI Container, and answer the following:
[Total: 6 Marks]
1. What is the property you should change, to make the form "Question 3" look this way?
IsMdiContainer
2. According to the image displayed above, write the proper code in "New Form" button that calls
objects of the other form with title determined by the user in the textbox.
Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Text = textBox1.Text;
f2.Show();
3. Add a line to your code, so that the generated forms would appear as in the following image:
3
LayoutMdi(MdiLayout.Cascade);
III. Unfamiliar Problem Solving
Objective: The aim of the question in this part is to evaluate that student can solve familiar problems with ease
and can make progress toward the solution of unfamiliar problems, and can set out reasoning and explanation in
clear and coherent manner of the topics related to the function.
Question4: Create the following form, which should perform the following: [5 Marks]
4
1. When the user presses "Add Root", a root node should be added to the tree.
(1 Mark)
treeView1.Nodes.Add(textBox1.Text);
2. When the user presses "Add Child", a child to the selected node should be added. (1 Mark)
treeView1.SelectedNode.Nodes.Add(textBox1.Text);
3. When double click on any node in the tree, check whither the node is already added to the listview:
a. If yes, increment the count
b. If no, add a new item with count = 1
(3 Marks)
private void treeView1_DoubleClick(object sender, EventArgs e)
{
bool found = false;
for (int i = 0; i < listView1.Items.Count; i++)
if (listView1.Items[i].Text == treeView1.SelectedNode.Text)
{
listView1.Items[i].SubItems[1].Text =
Convert.ToString(Convert.ToInt32(listView1.Items[i].SubItems[1].Text) + 1);
found = true;
}
if (!found)
listView1.Items.Add(treeView1.SelectedNode.Text).SubItems.Add("1");
}
Good Luck
5
Download