Top-Rated Free Essay
Preview

Computer Science: Exam Study Guide

Powerful Essays
2759 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Computer Science: Exam Study Guide
2014 Term II 1402 Final Exam Study Guide
Name___________________________________

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
1)

Which of the following displays a message box to the user?

1)

_______
A)

MessageBox.Output

B)

MessageBox.Display
C)

MessageBox.Show

D)

DisplayMessageBox 2)

The ________ keyword is required to use relational operators in a Case statement.

2)

_______
A)

To

B)

Is

C)

If

D)

else 3)

What value is assigned to the String variable strSecond when the following code is executes?

Dim strFirst As String
Dim strSecond As String strFirst = "1 2 Button My Shoe" strSecond = strFirstName.ToUpper()

3)

_______
A)

"1 2 BUTTON MY SHOE"

B)

"1 2 bUTTON mY sHOE"
C)

" BUTTON MY SHOE"

D)

"12BUTTONMYSHOE" 4)

Visual Basic uses ________ values to represent characters such as A, B, and C in memory.

4)

_______
A)

ISO code

B)

BCD code

C)

ASCII code

D)

Unicode 5)

If a form contains two radio buttons (rad1 & rad2) and two check boxes (chk1 & chk2) and all four of these controls reside in the same group box, which of the following expressions can never be true?

5)

_______
A)

rad1.Checked=True and chk2.Checked=True
B)

rad1.Checked=True and rad2.Checked=True
C)

chk1.Checked=True and chk2.Checked=True
D)

rad2.Checked=True and chk1.Checked=True 6)

Which statement tests the value of an expression once and then uses that value to determine the result?

6)

_______
A)

If ... then ... Else

B)

Select Case ... Case Else
C)

If ... Then ... ElseIf

D)

If ... Now Then ... Never 7)

The expression Single.TryParse("12.5", sngNbr) performs the following:

7)

_______
A)

Returns False
B)

Returns True and places the value 12.5 in the variable sngNbr
C)

Returns True
D)

Places the value 12.5 in the variable sngNbr 8)

The expression IsNumeric(13.75) returns the value ________.

8)

_______
A)

1375

B)

14

C)

13.75

D)

True 9)

Because only one radio button in a group can be selected at any given time, they are said to be ________.

9)

_______
A)

mutually exclusive

B)

selectively unique
C)

dependent

D)

interdependent 10)

What value will be assigned to strGrade when intScore equals 90?

If intScore > 60 Then strGrade = "Passed"
End If
If intScore > 70 Then strGrade = "Your mother still loves you"
End If
If intScore > 80 Then strGrade = "Your parents would be Proud"
End If
If intScore > 90 Then strGrade = "Your family is proud of you"
End If

10)

______
A)

Your parents would be Proud

B)

Your mother still loves you
C)

Your family is proud of you

D)

Passed 11)

The expression Integer.TryParse("12.5", intNbr) performs the following:

11)

______
A)

Places the value 12.5 in the variable intNbr
B)

Returns True and places the value 12.5 in the variable intNbr
C)

Returns False
D)

Returns True 12)

To convert a copy of a String to all uppercase letters, use the ________ method of the String object.

12)

______
A)

ConvertToUpper

B)

ToString
C)

ToUpper

D)

ToUpperCase 13)

An If statement that appears inside another If statement is referred to as ________.

13)

______
A)

multi-level
B)

It's not possible for an If to appear inside another If.
C)

nested
D)

embedded 14)

Which statement assigns the string strAddress to label lblAddress while removing only trailing spaces?

14)

______
A)

strAddress.TrimEnd = lblAddress.Text

B)

lblAddress.Text = strAddress.TrimEnd()
C)

lblAddress.Text = strAddress.Trim()

D)

lblAddress.Text = TrimStart(strAddress) 15)

What is assigned to lblMessage.Text when the following code segment executes?

Dim strName1 As String = "Jim"
Dim strName2 As String = "John"
If strName1 > strName2 Then lblMessage.Text = "Jim is greater"
Else
lblMessage.Text = "John is greater"
End If

15)

______
A)

John is greater

B)

True

C)

False

D)

Jim is greater 16)

If the boolean expression A is True and B is False, the value of the logical expression A And B is ________.

16)

______
A)

1

B)

False

C)

0

D)

True 17)

Which of the following statements will display a message box with the text "line 1" on one line, and the text "line 2" on another line?

17)

______
A)

MessageBox.Show("line 1" & "\n" & "line 2")
B)

MessageBox.Show("line 1" "line 2")
C)

MessageBox.Show("line 1" & ControlChars.Crlf & "line 2")
D)

MessageBox.Show("line 1" & ControlCharsCrLf & "line 2") 18)

Which of the following code segments assigns the string "Great Year" to a label named lblMessage when the value in the variable sngSales is either greater than 50,000, or equal to 50,000?

18)

______
A)

If sngSales >= 50000 Then lblMessage.Text = "Great Year"
End If

B)

If sngSales <= 50000 Then lblMessage.Text = "Great Year"
End If
C)

If sngSales > 50000 Then lblMessage.Text = "Great Year"
End If

D)

If sngSales < 50000 Then lblMessage.Text = "Great Year"
End If 19)

Which function accepts a String as its argument and returns True if the string contains only numeric digits?

19)

______
A)

CStr

B)

IsNumber

C)

ToString

D)

IsNumeric 20)

What value will be assigned to intIndex when the following statements execute?

Dim strTarget As String = "asdsakfljfdgasldfjdl"
Dim intIndex = strTarget.IndexOf("as", 1)

20)

______
A)

0

B)

12

C)

-1

D)

13 21)

The first character in a string has an index of ________.

21)

______
A)

0

B)

the length of the string — 1
C)

1

D)

—1 22)

Suppose you want to verify that the user has entered a value into a text box named txtBox. Which of the following code segments responds with an appropriate message if the user does not enter a value?

22)

______
A)

If txtBox.Text = String.Empty Then MessageBox.Show("No data has been entered")
End If
B)

If txtBox <> String.Empty Then MessageBox.Show("No data has been entered")
End If
C)

If txtBox.Text = " " Then MessageBox.Show("No data has been entered")
End If
D)

If txtBox.text <> "" Then MessageBox.Show("No data has been entered")
End If 23)

If the boolean expression A is True and B is False, the value of the logical expression A Or B is ________.

23)

______
A)

True

B)

0

C)

False

D)

1 24)

Which statement copies a string from a textbox named txtLastName, converts the string to upper case and saves the string in strLastName?

24)

______
A)

txtLastName.Text = strLastName(ToUpper)
B)

strLastName = txtLastName
C)

strLastName = txtLastName.Text.ToUpper()
D)

strLastName = ToUpper(txtLastName.Text) 25)

Which type of loop repeats as long as its loop condition remains True?

25)

______
A)

Do ... Until

B)

Do ... Next

C)

Do ... While

D)

all of the above 26)

Which type of loop uses a pretest to initialize a counter variable and then increment the counter variable at the end of each iteration?

26)

______
A)

The Count … Until Loop

B)

The For … Next Loop
C)

The Do … While Loop

D)

The Do … Until Loop 27)

What value is assigned to lblSum.Text by the following code?

Dim intTotal As Integer = 0
For intOuter = 1 To 3 For intInner = intOuter To 3 intTotal += intOuter * intInner Next
Next
lblSum.Text = intTotal.ToString()

27)

______
A)

16

B)

25

C)

36

D)

9 28)

Setting this property to True will put the items in a ListBox in alphabetical order.

28)

______
A)

Reorder

B)

Sorted

C)

Alphabetic

D)

Ordered 29)

What will be the final value of intCount?

Dim intCount As Integer = 3
Do
intCount += 6
Loop While intCount < 20

29)

______
A)

21

B)

9

C)

15

D)

20 30)

This method erases all the items in a ListBox.

30)

______
A)

Items.Erase

B)

Items.Remove

C)

Items.Delete

D)

Items.Clear 31)

A ToolTip is a ________ that allows the programmer to create a small popup message that displays when the user places the mouse over a control.

31)

______
A)

control

B)

property

C)

function

D)

method 32)

How can you cause scroll bars to appear in a ListBox at runtime?

32)

______
A)

Set the ScrollBars property of the ListBox to True.
B)

Set the ScrollFlag property of the ListBox to True.
C)

Add a programming statement to call the ScrollBar method of the ListBox.
D)

A scroll bar is automatically added when a ListBox contains more items than can be displayed. 33)

In the following statement that begins a For Next loop, what is the purpose of the Step clause?

For intX = 1 to 100 Step 5

33)

______
A)

It causes intX to be decremented by 5 each time the loop repeats.
B)

It causes intX to be incremented by 5 each time the loop repeats.
C)

It causes intX to be initialized to 5 when the loop begins.
D)

It causes the loop to end when intX is equal to 5. 34)

The ________ method adds a new entry as the last item in a ListBox.

34)

______
A)

Items.New

B)

Items.Insert

C)

Items.Append

D)

Items.Add 35)

Which statement is True in regard to the following code?

intCount = 0
Do While intCount < 10 lstOutput.Items.Add("Good Job")
Loop

35)

______
A)

This is an infinite loop.
B)

The Items.Insert method should be used instead of Items.Add.
C)

The text Good Job should not have quotation marks around it.
D)

intCount should start at -1. 36)

The InputBox function always returns a ________ value.

36)

______
A)

Single

B)

Text

C)

Double

D)

String 37)

The entries in a ListBox are stored in the ________ property.

37)

______
A)

Entries

B)

Items.Count

C)

Text

D)

Items 38)

The SelectedItem property of a ListBox ________.

38)

______
A)

returns -1 if no item is selected
B)

contains the text of the currently selected item
C)

contains the index of the currently selected item
D)

returns the location of the currently selected item 39)

Which statement about the ListBox.Add method is true?

39)

______
A)

It can be used to place an item anywhere in the list.
B)

It always puts the item at the beginning of the list.
C)

It finds the sum of all of the items in the list .
D)

It will always place the item at the end of the list. 40)

Which property determines the amount of time, in milliseconds, that elapses between the user pointing the mouse at a control and the tool tip text's appearance?

40)

______
A)

InitialDelay

B)

FinalDelay

C)

ReshowDelay

D)

AutoPopDelay 41)

Which of the following statements will assign a random number between 1 and 50 inclusive to intNum?

41)

______
A)

intNum = rand.Next(50) + 1

B)

intNum = rand.Next(1, 50)
C)

intNum = rand.Next()

D)

intNum = rand.Next(50) 42)

If you do not provide an access specifier for a procedure, it will be designated ________ by default.

42)

______
A)

Public

B)

Private

C)

Friend

D)

Protected 43)

A is a special variable in a Sub or Function heading that receives an argument’s value/address from a calling procedure.

43)

______
A)

temporary variable

B)

sub variable
C)

constant

D)

parameter 44)

When a parameter is declared using the ________ qualifier, the procedure has access to the original argument variable and may make changes to its value.

44)

______
A)

ByDefault

B)

ByValue

C)

ByRef

D)

ByAddress 45)

All of the following are true about functions except ________.

45)

______
A)

they can return one or more values
B)

you can assign the return value from a function to a variable
C)

they must contain at least one Return statement
D)

you can use a function call in an expression 46)

When calling a procedure, passed arguments and declared parameters must agree in all of the following ways except ________.

46)

______
A)

the names of the arguments and parameters must correspond
B)

the number of arguments and the number of parameters must be the same
C)

the order of arguments and parameters must correspond
D)

the types of the arguments and parameters must correspond 47)

When a procedure finishes execution, ________.

47)

______
A)

control transfers to the next procedure found in the code
B)

the application waits for the user to trigger the next event
C)

the application terminates unless the procedure contains a Return statement
D)

control returns to the point where the procedure was called and continues with the next statement 48)

Which debugging command executes a function call without stepping through function’s statements?

48)

______
A)

Step Out

B)

Step All

C)

Step Over

D)

Step Into 49)

What value is assigned to the variable strSnip when the following statements execute?

Dim strSnip As String
Dim strFullString As String = "Washington" strSnip = strFullString.Substring(7)

49)

______
A)

"ash"

B)

"ton"

C)

"Was"

D)

"Washing" 50)

Which is a correct way to call the method that displays a message box?

50)

______
A)

MessageBox.Show(Icon, Caption, Message, DefaultButton)
B)

MessageBox.Send(Message, Caption, Buttons, Icon, DefaultButton)
C)

MessageBox.Message(Caption, Message, Buttons, Icon, DefaultButton)
D)

MessageBox.Show(Message, Caption, Buttons, Icon, DefaultButton) 51)

The first item in a ListBox has an index of ________.

51)

______
A)

Items.Count

B)

1

C)

0

D)

1 52)

How many times will the message I love Visual Basic be displayed?

Dim intCount As Integer = 0
Do
lstOutPut.Items.Add("I love Visual Basic") intCount += 1
Loop While intCount > 10

52)

______
A)

It will not be displayed at all.

B)

It will display 10 times.
C)

It will display 2 times.

D)

It will display once. 53)

A difference between a ListBox and a drop-down ComboBox is ________.

53)

______
A)

a ComboBox allows the user to enter text other than what is already in the List
B)

there is no difference
C)

a ListBox takes up less room on the form
D)

a ListBox allows the user to enter text other than what is already in the List 54)

Which of the following statements correctly displays an input box?

54)

______
A)

strUserInput = InputBox(Enter your First Name, Enter Name)
B)

strUserInput = Input("Enter your First Name")
C)

strUserInput = Input("Enter your First Name", "Name")
D)

strUserInput = InputBox("Enter your First Name", "Enter Name") 55)

To get the number of items stored in a ListBox, use the ________ property.

55)

______
A)

Count

B)

Items

C)

Number

D)

Items.Count 56)

Which of the following controls and methods provides a simple way to gather input from the user at runtime without placing a text box on a form?

56)

______
A)

MessageBox

B)

InputBox

C)

ComboBox

D)

ListBox 57)

Which statement is not true regarding functions?

57)

______
A)

Visual Basic has many built-in functions such as CSng(txtInput.Text)
B)

The same function can return several data types including integer, string, or double
C)

A function is a self contained set of statements that can receive input values.
D)

A function can only return a single value. 58)

The ________ method can be used to place a new item at any position in a ListBox.

58)

______
A)

Items.Insert

B)

Items.Append

C)

Items.Add

D)

Items.New 59)

Which of the following can be returned by a function?

59)

______
A)

String values

B)

Boolean values

C)

Integer values

D)

all of the above 60)

Which of the following declares a local variable that retains its value throughout every call to its procedure?

60)

______
A)

Sub variableName As Static

B)

Dim variableName As Static
C)

Static variableName As DataType

D)

Dim variableName As DataType = Static 61)

Which standard Visual Basic function returns the periodic payment amount for a loan?

61)

______
A)

PPmt

B)

LPmt

C)

IPmt

D)

Pmt 62)

All of the following are valid ComboBox style properties, except ________.

62)

______
A)

Drop-Down Combo Box

B)

List Combo Box
C)

Drop-Down List Combo Box

D)

Simple Combo Box 63)

In the context of Visual Basic procedures and functions, what is an argument?

63)

______
A)

A value passed to a procedure by the caller.
B)

A disagreement between the procedure and the statement that calls it.
C)

A local variable that retains its value between procedure calls.
D)

A value received by a procedure from the caller 64)

A counter is a ________ that can be incremented or decremented each time a loop runs.

64)

______
A)

string variable

B)

property

C)

integer variable

D)

condition TRUE/FALSE. Write 'T' if the statement is true and 'F' if the statement is false.
65)

If the boolean expression on the left side of an OrElse operator is true, the boolean expression on the right side of the Or operator will not be evaluated.

65)

____T__ 66)

When debugging a program in break mode, the Step Into command causes the currently highlighted line of code to execute.

66)

___F___ 67)

The logical operators (And, Or, Xor, Not) combine two or more boolean expressions.

67)

___T___ 68)

The programmer cannot determine the content of a message box title bar.

68)

___F___

You May Also Find These Documents Helpful

  • Satisfactory Essays

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 1248 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 3668 Words
    • 15 Pages
    Good Essays
  • Good Essays

    Chem Test 1

    • 1214 Words
    • 5 Pages

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 1214 Words
    • 5 Pages
    Good Essays
  • Better Essays

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 1397 Words
    • 6 Pages
    Better Essays
  • Satisfactory Essays

    unit 5 assignment 1

    • 423 Words
    • 3 Pages

    4. The AND operator connects two Boolean expressions into one compound expression. Both must be true for the compound expression to be true.…

    • 423 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Exam Study Guide

    • 566 Words
    • 3 Pages

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 566 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Bsbwor501 Final Exam

    • 686 Words
    • 3 Pages

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 686 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    FINA 307

    • 3092 Words
    • 14 Pages

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 3092 Words
    • 14 Pages
    Powerful Essays
  • Satisfactory Essays

    If it isn't, then you don't know for sure what value it will start at in some languages. Your count will be inaccurate. In other languages, it will just generate an error if you forget to initialize.…

    • 351 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 1610 Words
    • 7 Pages
    Good Essays
  • Good Essays

    Env Sci Help

    • 5433 Words
    • 22 Pages

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 5433 Words
    • 22 Pages
    Good Essays
  • Better Essays

    Geology Study Guide

    • 3843 Words
    • 16 Pages

    MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.…

    • 3843 Words
    • 16 Pages
    Better Essays
  • Powerful Essays

    A divide and conquer approach permits concerns related to networking hardware to be completely separated from those related to networking software.…

    • 694 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    complicated analysis

    • 1848 Words
    • 8 Pages

    8086-80486 – Inst Set & ALP MOV Revisted EX 1. Swap the word at memory location 24000H with 25000H 24000H 24001H 25000H 25001H MOV AX, 2000H • Initialise Segment Register • Initialise Offset Registers • Transfer data from reg to mem temporarily • Store back the data in mem MOV DS, AX MOV SI, 4000H MOV DI, 5000H MOV BX, [SI] MOV DX, [DI] MOV [SI], DX MOV [DI], BX Ex 2 MOV BX, 2000H MOV DI, 10H MOV AL, [BX+DI] MOV DI, 20H MOV [BX+DI], AL DS: 2020  DS: 2010 Different mov options R  M M  R R  R M  I R  I MOV DST,SRC • Copies the contents of source to destination •…

    • 1848 Words
    • 8 Pages
    Satisfactory Essays
  • Powerful Essays

    memory layout

    • 3957 Words
    • 16 Pages

    For instance the global string defined by char s[] = “hello world” in C and a C statement like int debug=1 outside the main (i.e. global) would be stored in initialized read-write area. And a global C statement like const char* string = “hello world” makes the string literal “hello world” to be stored in initialized read-only area and the character pointer variable string in initialized read-write area.…

    • 3957 Words
    • 16 Pages
    Powerful Essays

Related Topics