Coffeehouse Post

Single Post Permalink

View Thread: Interview questions
  • User profile image
    prog_dotnet

    Normally, statements are executed one after another in the order in which they are written. This is called sequential execution. However, various VB.NET statements enable the programmer to specify that the next statement to be executed might not be the next one in sequence. 
    A transfer of control occurs when an executed statement does not directly
    follow the previously executed statement in the written program.
    During the 1960s, it became clear that the indiscriminate use of transfers of control was
    causing difficulty for software development groups. The problem was the GoTo statement, which allows the programmer to specify a transfer of control to one of a wide range of possible destinations in a program.
    The excessive use of GoTo statements caused programs to become quite unstructured and hard to follow. Since that point in time, the notion of structured
    programming became almost synonymous with “GoTo elimination.”
    The research of Bohm and Jacopini demonstrated that all programs containing GoTo statements could be written without them. Programmers’ challenge during the era was to shift their styles to “GoTo-less programming.” It was not until the 1970s that programmers started taking structured programming seriously.
    The results have been impressive, as software development groups have reported reduced development times, more frequent ontime
    delivery of systems and more frequent within-budget completion of software projects.
    The key to these successes is that structured programs are clearer, easier to debug and modify and more likely to be bug-free in the first place.

    Bohm and Jacopini’s work demonstrated that all programs could be written in terms of only three control structures:
    Namely, the sequence structure, the selection structure and the repetition structure. The sequence structure is built into Visual Basic.
    ---------------------------------

    Visual Basic provides three types of selection structures.

     The If/Then selection structure performs (selects) an action (orsequence of actions) if a condition is true or skips the action (or sequence of actions) if thecondition is false.
    The If/Then/Else selection structure performs an action (or sequence of actions) if a condition is true and performs a different action (or sequence of actions) if the condition is false.
    The Select Case structure, performs one of many actions (or sequences of actions), depending on the
    value of an expression.

    The If/Then structure is called a single-selection structure because it selects or ignores a single action (or a sequence of actions).
    The If/Then/Else structure is called a double-selection structure because it selects between two different actions (or sequences of actions).
    The Select Case structure is called a multiple-selection structure because it selects among many different actions or sequences of actions.

    Visual Basic provides seven types of repetition structures; —While, Do While/Loop, Do/Loop While, Do Until/Loop, Do/Loop Until, For/Next and For Each/Next.

    The words If, Then, Else, End, Select, Case, While, Do, Until, Loop,For, Next and Each are all Visual Basic keywords
     So to conclude;
    Visual Basic has 11 control structures;
    sequence, three types of selection and seven
    types of repetition.
    Each program is formed by combining as many of each type of control structure as is necessary.