COIS 1520H Midterm Flashcards

1
Q

What does “IDE” stand for?

A

Integrated Development Environment

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

Why use IDE?

A

Machine Learning - hard for humans to understand
Program Complex tasks - broken into instructions for the computer
Interface between humans/computers - translates commands into machine language (when code compiled)

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

What are the three main components of any program?

A

Input, Processing, Output

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

What are some examples of sources of input and output for a program?

A

Input: keyboard, mouse, code

Output: screen, printer, speaker, etc.

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

What is an algorithm?

A

Set of instructions to perform a task

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

What are the six steps in the Program Development Cycle, and explain each one.

A

Analyze: Define the problem

Design: Plan the solution

Choose the interface: Select the objects (text boxes, buttons, etc)

Code: Translate algorithm into programming language

Test and Debug: Locate and remove any errors

Documentation: organize all materials that describe the program

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

Name three programming tools that help convert algorithms into code, and explain each one.

A

Flowcharts: graphically depicts the logical steps to carry out a task and shows
how the steps relate to each other

Pseudocode: use English-like phrases with some non-language dependent
programming constructs to outline the program

Hierarchy chart: shows how the different parts of a program relate to each
other

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

What is the “Divide-and-conquer” method?

A

Take a large problem and break it down into smaller problems solving the small ones first

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

Name and explain the three statement structures that are available in programming .

A

Sequence: follow instructions from one line to the next without skipping over
any lines.

Decision: if the answer to a question is “yes” then one group of instructions is
executed. If “no”, then another is executed.

Looping: a series of instructions are executed over and over. (Need a
“terminating condition”, otherwise you have an infinite loop.)

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

Explain what a GUI is.

A

Graphical User Interface
- Provides an easy-to-understand environment
- Can concentrate on coding, less on learning
environment.

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

Define an “event-driven” language.

A

Sequence of instructions executed is controlled by

events; “No events = no action”

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

Name four different controls that are available to us when designing a form

A

Text Box control
Button control
Label control
List Box control

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

Name a control that can be used for both input and output.

A

Form control; when used for output - ReadOnly property should be set to True

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

Describe how the AutoSize property works for a label: what does it do?

A

When True, label will resize automatically to
display caption on one line

When False, label can be resized manually.
Allows for multi-rowed label.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • Name the two primary purposes for a list box control.
A
  1. Used to display several pieces of output.

2. Allows user to select items from a list.

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

What is the difference between a proportional-width font and a fixed-width font?

A

Proportional-width fonts take up less
space for “I” than for “W”

Fixed-width fonts take up the same
amount of space for each character

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

Describe the tab order on a form, and why it is important.

A

Determines order of focus when tabbing; starts at 0.

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

What is an event?

A

An event is an action, such as the user clicking on a button

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

Name and describe the steps in creating a Visual Basic program:

A

Create interface: generate position and size the objects

Set properties: configure the appearance of the objects

Write the code: this executes when events occur

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

Name two ways to get access to the event procedures for an object:

A

Double-click on a control

Use the Class Name and Method Name boxes

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

Describe how a txt file can be used for both input and output.

A

Can be created, viewed, and managed by the Visual Basic IDE

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

Define a numeric variable.

A

A numeric variable is a container to which a number can be assigned.

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

What value are numeric variables automatically initialized to?

A

0

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

Show two different ways that var can be incremented by 1

A

var = var + 1, var += 1

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

What is a Function?

A

Functions return a value; e.g. Math.Sqrt(9) returns 3

26
Q

Why can Double variables be assigned both whole numbers and numbers with decimals?

A

No loss of precision

27
Q

Can you assign a decimal number to an Integer? Why or why not?

A

No; loss of precision

28
Q

Name and describe three different types of errors that can be encountered in Visual Basic:

A

Syntax:
Easiest to detect, as usually caught by compiler!

Run-time:
More difficult to detect.

Logic:
- Most difficult to detect, as no obvious errors
are visible.
- Might require domain knowledge of problem to
detect.

29
Q

What are the Three Types of Errors?

A

Misspellings

Omissions

Incorrect punctuation

30
Q

What is a string literal?

A

A string literal is a sequence of characters surrounded by quotation marks

31
Q

The contents of a textbox is always a ___________.

A

String

32
Q

How would you convert the contents of a textbox into a Double?

A

dblVar = CDbl(txtBox.Text)

33
Q

How do you combine two strings?

A

Append with &

34
Q

What is syntax of SubString?

A

str.Substring(m, n)

35
Q

What is the purpose of the IndexOf method?

A

Reports position of first occurrence of one string within another

36
Q

What is the default initial value of a String?

A

Nothing

37
Q

What is Widening? Does it work all the time?

A

Widening: assigning an Integer value to a Double variable.
Widening always works. (Every Integer is a Double).
Works because there is no loss of precision.
No conversion function needed.

38
Q

What is Narrowing? Does it work all the time?

A

Narrowing: assigning a Double to an Integer.
Might not work (loss of precision, not every Double is an Integer).
Narrowing requires CInt.

39
Q

What are three reasons for using Internal Documentation?

A
1. Other people can easily understand the
program.
2. You can understand the program when
you read it later.
3. Long programs are easier to read
because the purposes of individual
pieces can be determined at a glance.
40
Q

What is the Line-Continuation Character, and why would you use it?

A

Long line of code can be continued on another line by using an underscore (_)
preceded by a space.

“I’m going to make “ & _
“him an offer he can’t refuse.”

41
Q

Define what the scope of a variable is, and provide examples.

A

Scope of a variable refers to the portion of the program that can refer to that
variable.
e.g. class-level scope

42
Q

o What is class-level scope?

A

Variables declared outside a procedure are said to have class-level scope and are available to every event procedure

43
Q

Explain automatic colorization.

A

Comments – green

String literals – maroon

Keywords – blue

44
Q

Describe how you would use a StreamReader object to get input from a text file.

A

Execute a statement of the form

Read items of data in order, one at a time, from the file with the ReadLine method

Terminate the communications link

45
Q

What is the difference between a Mask textbox and a regular text box?

A

Similar to ordinary text box, but has Mask property that restricts what can be typed into the masked text box

46
Q

What is the ANSI Character set?

A

A numeric representation for every key on the keyboard and for other assorted
characters

47
Q

What is the difference between Chr(n) and Asc(str), and give an example of both?

A

Asc (“¢25” ) is 162;
Chr (162) is “¢25”

Chr(n) and Asc(str)

48
Q

Name and describe the six different relational operators that are possible in Visual Basic.

A
< less than
<= less than or equal to
> greater than
>= greater than or equal to
= equal to
<> not equal to
49
Q

What is a condition?

A

A condition is an expression involving relational and/or logical operators;

Evaluates to True or False if evaluated in Boolean

50
Q

In what order are expressions evaluate? Can we alter this order?

A

Expressions are evaluated from left to right with no order of operations; will always be True or False

51
Q

In what order are expressions evaluate? Can we alter this order?

A

Expressions are evaluated from left to right with no order of operations; will always be True or False

52
Q

Name and describe the three different logical operators that are possible in Visual Basic.

A

Not – makes a False expression True and
vice versa.

And – will yield a True if and only if both expressions are True.

Or – will yield a True if at least one of both expressions are True

53
Q

What logic takes place with an IF block?

A

The program will take a course of action based on whether a condition is true

54
Q

What is a nested IF block?

A

When one If block is contained inside another If block

55
Q

A selection from many possibilities can be accomplished through IF blocks, ELSEIF structures, or
______________?

A

Select Case

56
Q

Define block-level scope

A

A variable declared inside an If … Then or Select Case block

57
Q

Define “arguments” and “parameters” and give examples.

A

Parameters are the names of the variables defined in a function or method

An argument is the value used when calling the function

58
Q

Define “arguments” and “parameters” and give examples.

A

Parameters are the names of the variables defined in a function or method

An argument is the value used when calling the function

59
Q

Define the “Top-down” design methodology.

A
Stepwise refinement (aka divide-and-conquer) is part of top-down design 
methodology

General problems at Top
Specific tasks near bottom

60
Q

What are the advantages of structure programming?

A

Easy to Write:

  • focus on big picture, deal with details later
  • several programmers can work on same program simultaneously
  • code can be reusable

Easy to Understand:

  • interconnectedness of procedures
  • meaningful procedure names & comments to identify tasks performed by the modules
  • meaningful variable names

Easy to Change:
- structured program is self-documenting, can be deciphered by another programmer

61
Q

What constructs do

we use for structured programming?

A

Sequences:
Statements are executed one after another

Decisions:
One of two blocks of program code is executed based on a test for some
condition

Loops (iteration):
One or more statements
are executed repeatedly as long as a specified condition is true

62
Q

Define OOP (object-oriented programming)

A

An encapsulation of data and code that operates on the data.

Objects have properties, respond to methods, and raise events.