Chapter 1 : Introduction to Visual Programming Flashcards

1
Q

What components respond to actions from users such as mouse clicks, pressing keys on keyboards or placing the mouse cursor over user interface objects

A
  1. Graphical User Interface ( GUI )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the actions known as ? ( mouse click, pressing key on keyboards )

A
  1. Event
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does a Visual C# applications project start with? ( 3 )

A
  1. Designer
  2. Toolbox
  3. Property Window
  • An empty form is generated and its name is Form1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the form basic width and height

A
  1. 300 pixel each
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the property window do?

A
  1. Change the settings for the appearance and other characteristics of a GUI object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What will be displayed in the column’s property list? ( 2 )

A
  1. Left Column
    • Property’s Name
  2. Right Column
    • Property’s Value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is controls name

A
  1. Identifiers of the controls
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List out the rules for naming controls

A
  1. The first character must be letter ( lower , uppercase doesn’t matter ) or an underscore
  2. All other characters can be alphanumerical characters or underscores
  3. The name cannot contain spaces
  • Example
    showDayButton
    DisplayTotal
    _ScoreLabel
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

List out 3 ways for how C# code is primarily organized?

A
  1. Namespace
    • A container that holds classes
  2. Class
    • A container that holds methods
  3. Method
    • Group of one or more programming statements that perform some operations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a file that containes program code is called?

A
  1. Source Code File
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What source code file that is automatically created when creating a new project?

A
  1. Program.cs
    • Contains the application’s start-up code to be executed when the application runs
  2. Form1.cs
    • Contains code that is associated with the Form1 form
  • Can open through Solution Explorer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does C# code is organized?

A
  1. As methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does a program waits in event-driven programming?

A
  1. An event to occur after executed
  2. Determine how controls ( button, textbox ) respond to events that are set for the respective control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Who controls the program response in event-driven programming?

A
  1. User
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

List out 3 ways that the event can occur

A
  1. The user doing something ( Click a button )
  2. Something happening within th ecomputer ( System Shutdown )
  3. Something happening within the program ( Program Crash )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

List out 5 types of events

A
  1. Activate Events
    • User selects item on screen
  2. Changed Events
    • Control property modified
  3. Focus Events
    • Control gets or loses focus
  4. Key Events
    • User interacts with keyboard
  5. Mouse Events
    • User interacts using mouse
17
Q

What is an event handler? ( 2 )

A
  1. Method that executes when a specific takes place
  2. Code segment similar to the following will be created automatically

private void myButton_Click(object sender, EventArgs e)
{
}

18
Q

What does a message box does?

A
  1. Displays a message
19
Q

What is the code for showing a message box?

A
  1. MessageBox.Show(“Hello”)
  • Placing it inside the event handler ( button ) can display the string in the message box when the button is clicked
20
Q

What does a label do?

A
  1. Display text on a form and can be used to display unchanging text or program output
21
Q

List out 6 commonly used properties

A
  1. Text ( Displayed text )
  2. Name ( Method name )
  3. Font
  4. BorderStyle
  5. AutoSize
  6. TextAlign
22
Q

List out 9 values that the TextAlign property supports

A
  1. TopLeft
  2. TopCenter
  3. TopRight
  4. MiddleLeft
  5. MiddleCenter
  6. MiddleRight
  7. BottomLeft
  8. BottomCenter
  9. BottomRight
  • Select by clicking the dropdown button in TextAlign property
23
Q

How to change a property ( Change label text from “Hi” to “Hello” ) ?

A
  1. Use Assignment Operator ( = )

label1.Text = “Hello”;

  • Details
    1. Control name followed by a dot
    2. Property to be modified ( left side , .Text )
    3. Value to be assigned ( Right side , = “Hello” )
24
Q

How to change the color properties?

A
  1. Using class name Color followed by a dot

label1.BackColor = Color.blue

25
Q

How to use concatenation?

A
  1. With the + operator

label1.Text = “Welcome ” + “ to C#”;

26
Q

What is the difference when the concatenation operator ( + ) is used in
1. int , double
2. string

A
  1. Arithmetic ( Add )
  2. Concatenate ( Join String )
27
Q

How to change the form properties?

A
  1. Using this keyword

private void button1_Click(object sender, EventArgs e)
{
this.BackColor = Color.Red ;
}

  • When the button1 is clicked, the background color will be changed to Red
28
Q

What does IntelliSense does?

A
  1. Provides automatic code completion as I write programming statements
  • Access through Ctrl + .
  • Provides an array of options that make language reference easily accessible
29
Q

List out C# comments for :
1. Single Line Comment
2. Multiline Comment

A
  1. //
    • // This is single line
  2. /**/
    • /*
      This is
      multiline comment
      */
30
Q

Why does programmes frequently use blank lines and indentation in their codes?

A
  1. To make code more human-readable
31
Q

What code should I add when I want to close an application’s form in code?

A
  1. this.Close()
  • it is commonly used in an Exit button
    private void exitButton_Click(object sender, EventArgs e)
    {
    // Close the form.
    this.Close();
    }
32
Q

What causes syntax errors?

A
  1. Misspelled words and missing punctuation
33
Q

How would IDE perform to when having Syntax Errors?

A
  1. Normally trapped by IDE as they are typed
  • Explanation shown when cursor held over error
  • Should be corrected before running program
34
Q

What would compiler do when having syntax errors

A
  1. Uncorrected syntax errors
    • Message box prompts user to continue
    • Error list window displays compilation errors

MessageBox.Show(“Bye)

35
Q

What underline style when a syntax error is found?

A
  1. Jagged line
36
Q

Why Run-time errors occured?

A
  1. Invalid calculation
  2. Attempt to open a non-existent file
37
Q

When does Run-time errors occured?

A
  1. Only apparent when program runs
38
Q

What will be displayed when run-time errors occured?

A
  1. IDE displays a message box
    • Nature of error
    • Approximate location of error ( line number )