Visual and Quick Basic Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How do we declare variables? Initialize?

A

the command DIM declares variables.
ex: DIM address AS STRING

initializing assigns data to a variable

ex: address = “156 Sunnyside Way”
ex: age = 15

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

What is a variable?

A

A variable is a place in computer memory where information is stored. They are called variables because they can change as the program is execute.

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

Why do we need variables

A

We need them because they store data for future use

ex: If the user is asked for their name, the computer should remember it

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

Two main facts about variables? (hint: relates to memory)

A
  1. we reserve memory for them

2. we give this memory a location name so we can refer to it later in our program

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

What are the 5 rules about declaring variables?

A
  1. No special characters (can contain only letters, numbers and periods)
  2. No spaces
  3. Cannot be over 40 characters long
  4. Cannot use command words (ex: print, input, etc.)
  5. Must begin with a letter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When do we use STRING?

A

when we want to use characters (they can have numbers in them too)
ex: DIM name as STRING

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

When do we use INTEGER?

A

when we want to use numbers without decimals (can be negative)
ex: DIM age AS INTEGER

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

When do we use SINGLE?

A

when we want to use a number that has decimals

ex: DIM weight AS SINGLE

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

What command do we use when we want the user to respond to a prompt?

A

INPUT “string”, variable

remember: use a comma to have no ‘?’ and a semi colon to have one

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

How do we use the random number function?

A

int (rnd * how many numbers in range + min num)
ex: range between 10 and 20 is
int(rnd * 11 + 10) NOT int(rnd * 20 + 10)

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

When would I use ‘PRINT USING’?

A

When you want to format how you print something.
ex: if I wanted 12.5 in price format ($12.50)
PRINT USING “$##.##”; 12.5

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

In Quick Basic, if I want to join a variable and a piece of text, I will do what..?

A

print “hello, “; name ; “. how are you?”

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

In Visual Basic, if I want to join a variable and a piece of text, I will do what..?

A

print “hello, “ & name & “. how are you?”

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

In Visual Basic, what is a ‘module’?

A

A block of code associated with an object or event. AKA the code between “Private Function” and “End Sub”.

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

In VB, what is a ‘property’?

A

An attribute or setting of an object. eg: Command1 has a default property of enabled = true.

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

In Visual basic, give an example of a property to modify in form, text box, image, label, and command.

A
form: caption
text box: text
image: picture
label: caption
caption:
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Things to remember while writing code and looking for errors:

A
  1. Always initialize variables no matter what!!
  2. Try not to look for things that ‘aren’t needed’
  3. Strings can have numbers and always need “ “
18
Q

VB is different from QB because …

A

VB includes visual and graphic interactive aspects while QB uses mainly sound and text and the only interactive feature is entering a text

19
Q

four different types of controls in VB

A

label, textbox, command, image

20
Q

method

A

A block of code associated with an object or event. AKA the code between “Private Function” and “End Sub”

21
Q

Window

A

all our code

22
Q

example of event

A

clicking a button (event handler say what happens when you for ex. click the button)

23
Q

IDE

A

Integrated developing environment

24
Q

MID

A

et ‘n’ characters starting on the ‘m’th character in a string. eg: print MID(string,m,n)

25
Q

right

A

Get the rightmost ‘n’ characters in a string eg: print RIGHT(string,n)

26
Q

left

A

Get the leftmost ‘n’ characters in a string eg: print LEFT (string,n)

27
Q

UCASE

A

the word prints in upper case letters

eg: print UCASE(string)

28
Q

LCASE

A

the word prints in lower case letters

eg: print LCASE(string)

29
Q

STR

A

turns number into a string

eg. STR(number)

30
Q

VAL

A

turns string to number

eg. VAL(“string”)

31
Q

what are some early computer coding languages

A

Qbasic
COBAL
FORTRAN

32
Q

Recent languages

A

Java
Visual Basic
C++

33
Q

Q basic is _______ programing

A

interpretive

34
Q

Uses for QB

A

Games,
Small simulations,
Math programs,
Programming contests.

35
Q

Two reasons programs won’t work

A
Syntax errors (bad spelling)
logic errors (bad instructions)
36
Q

What is ‘debuging’?

A

finding and fixing problems in code.

37
Q

t or f: print using function will round numbers

A

true.
eg. PRINT USING “$0.00” ; 9.999
will output as: $10.00

38
Q

color code of black, white, red

A

00 - black
04 - red
15 - white

39
Q

how do you centre a word?

A

find the length of the word + divide that number by two
and subtract it from 40.
Y= 40 - ( LEN(string) /2

40
Q

in less than or equal to is the = sign before or after

A

after!