• Welcome to Valhalla Legends Archive.
 

How programmers study for a multiple-choice final exam

Started by Spht, December 04, 2007, 04:46 PM

Previous topic - Next topic

Spht

Our final exam in strategic management is worth 60% of our final mark and consists entirely of multiple choice questions. our teacher gave us a booklet of 115 multiple choice questions to study, along with the answers

Sitting down and reading through all the questions seemed like a highly boring and inefficient way of studying, so instead i made a program to help me

I started by scanning the 25-page document in microsoft word with an OCR scanner.  i then was able to quickly create a database that contains the answer, along with the questions & choices, which looks like this:

A
Research suggests that strategic management evolves through four sequential phases in organizations. The first phase is
A) basic financial planning.
B) forecast-based planning.
C) internally-oriented planning.
D) externally-oriented planning.
E) strategic management.

D
Under the phase of strategic management, strategic information is available to
A) operational personnel.
B) middle management.
C) the top management responsible for decision making.
D) people throughout the organization.
E) none of the above

B
Organizational performance can be indicated by:
A) lack of labor unions
B) outcomes, processes and capabilities.
C) dividends declared and paid.
D) assets, liabilities and equity.
E) an organization's size.


Next, I put together a quick VB application that consists of a text box containing the current question and choices, and 5 buttons to select the answer.  It will pull out a random question from the database and randomize the order the choices are listed in each time



Option Explicit

Private Questions As Collection
Private Answers As New Collection
Private CurrentAnswer As String
Private CurrentAnswerEx As String
Private Streak As Long

Private Sub cmdAnswer_Click(Index As Integer)
    If CurrentAnswer = cmdAnswer(Index).Caption Then
        Streak = Streak + 1
        MsgBox "Good job!" & vbCrLf & vbCrLf & _
            "The answer was: " & CurrentAnswer & vbCrLf & _
            "Streak: " & Streak, vbInformation, "Correct!"
    Else
        Streak = 0
        MsgBox "The answer was: " & CurrentAnswer & CurrentAnswerEx, vbExclamation, "Incorrect!"
    End If
   
    GetNextQuestion
End Sub

Private Sub ReadQuestions()
    Dim FreeNum As Long
    Dim s As String
    Dim adds As String
   
    Set Questions = Nothing
    Set Questions = New Collection
   
    If Len(Dir(App.Path & "\smquestions.txt")) Then
        FreeNum = FreeFile
        Open App.Path & "\smquestions.txt" For Input As #FreeNum
            Do While Not EOF(FreeNum)
                Line Input #FreeNum, s
                If Len(s) = 0 Then
                    adds = Replace(adds, vbCrLf & "A)", vbCrLf & vbTab & "A)")
                    adds = Replace(adds, vbCrLf & "B)", vbCrLf & vbTab & "B)")
                    adds = Replace(adds, vbCrLf & "C)", vbCrLf & vbTab & "C)")
                    adds = Replace(adds, vbCrLf & "D)", vbCrLf & vbTab & "D)")
                    adds = Replace(adds, vbCrLf & "E)", vbCrLf & vbTab & "E)")
                    Questions.Add adds
                    adds = ""
                Else
                    adds = adds & s & vbCrLf
                End If
            Loop
        Close #FreeNum
    End If
End Sub

Private Sub GetNextQuestion()
    Dim NextQuestion As String
    Dim s
    Dim i As Long
    Dim n As Long
   
    NextQuestion = Questions.Item(Int((Questions.Count * Rnd) + 1))
    s = Split(NextQuestion, vbCrLf & vbTab)
    s(5) = Left(s(5), Len(s(5)) - 2) ' remove trailing vbCrLf
    For i = 1 To 5
        Answers.Add s(i)
    Next i
    For i = 1 To 5
        n = Int((Answers.Count * Rnd) + 1)
        s(i) = Answers.Item(n)
        If Left(s(i), 1) = Left(NextQuestion, 1) Then
            CurrentAnswer = cmdAnswer(i - 1).Caption
            CurrentAnswerEx = Mid(s(i), 2)
        End If
        Mid(s(i), 1, 1) = cmdAnswer(i - 1).Caption
        Answers.Remove n
    Next i
   
    txtQuestion.Text = Mid(NextQuestion, 4, InStr(NextQuestion, vbCrLf & vbTab) - 4) & vbCrLf & _
        vbTab & s(1) & vbCrLf & _
        vbTab & s(2) & vbCrLf & _
        vbTab & s(3) & vbCrLf & _
        vbTab & s(4) & vbCrLf & _
        vbTab & s(5) & vbCrLf
End Sub

Private Sub Form_Load()
    Randomize
    ReadQuestions
    GetNextQuestion
End Sub


Well, i must get back to studying now

MyndFyre

Turn that into your teacher.  Maybe (s)he'll give you full credit for the exam! :D
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

warz


Barabajagal

Just a suggestion, but you really should make the answer choices random. Otherwise, your mind will most likely associate the questions with the letter value (A, B, C, D, or E) instead of the actual answer.

brew

Quote from: MyndFyre[vL] on December 04, 2007, 04:55 PM
Turn that into your teacher.  Maybe (s)he'll give you full credit for the exam! :D
I'm sure strategic management teachers will be in shock and awe when one of their students used VB6 to script a quick random multiple choice question-er. IMO what you should've done instead of scanning it, is typing them in. Typing a 25 page document isn't too impractical, and it'd help you actually remember the questions/answers.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Spht

Quote from: Andy on December 04, 2007, 05:38 PM
Just a suggestion, but you really should make the answer choices random. Otherwise, your mind will most likely associate the questions with the letter value (A, B, C, D, or E) instead of the actual answer.

Yeah, i realized that, and it does do that. see getnextquestion()

Quote from: brew on December 04, 2007, 06:05 PM
IMO what you should've done instead of scanning it, is typing them in. Typing a 25 page document isn't too impractical, and it'd help you actually remember the questions/answers.

I considered that, but i'm not the fastest nor accurate typer (especially if i have to study it while typing).  i figure i'd learn at a lot faster pace using the program in the time it would've taken to type it all up rather than scan it

Dale

Good job, I did the same thing back in 7th grade for the periodic table and the elements.