BASIC Programming: GOSUB Command
12 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does GOSUB do in early BASIC variants?

  • Jumps to a specified line number (correct)
  • Specifies data types
  • Returns a value
  • Ends the subroutine
  • What happens when an argument is passed ByRef?

  • The procedure cannot modify the passed variable
  • The argument is treated as a value
  • The argument is copied
  • The procedure can modify the passed variable (correct)
  • In Microsoft Small Basic, what is the keyword used to denote the start of a subroutine?

  • Function
  • Sub (correct)
  • Subroutine
  • Begin
  • In C and C++, what is a function that does not return a value called?

    <p>Void function</p> Signup and view all the answers

    What does passing an object ByVal do?

    <p>Copies the reference to the object</p> Signup and view all the answers

    What does the keyword 'Function' represent in Visual Basic (VB)?

    <p>Returning no value</p> Signup and view all the answers

    What is the default data type for parameters in Visual Basic (VB) if not specified?

    <p>Object</p> Signup and view all the answers

    In PL/I, what information can be provided by a descriptor when passing arguments to a procedure?

    <p>String lengths and array bounds</p> Signup and view all the answers

    What does the Sub keyword signify in relation to returning values in Visual Basic (VB)?

    <p>Returning no value</p> Signup and view all the answers

    What does the ampersand (&) signify when used in a function call like addTwo(&v)?

    <p>It stands for address of v</p> Signup and view all the answers

    What characteristic distinguishes a free function from a member function in C++?

    <p>Definition within a class</p> Signup and view all the answers

    What concept does the procedure represent in Visual Basic (VB) when used in a class?

    <p>Method</p> Signup and view all the answers

    Study Notes

    Subroutines and Functions

    • In early BASIC variants, GOSUB allows a program to jump to a subroutine and return to the original location when the subroutine is finished.

    ByRef Argument Passing

    • When an argument is passed ByRef, a reference to the original variable is passed, allowing the called procedure to modify the original variable.

    Microsoft Small Basic

    • In Microsoft Small Basic, the keyword Sub is used to denote the start of a subroutine.

    C and C++

    • In C and C++, a function that does not return a value is called a void function.

    ByVal Argument Passing

    • When an object is passed ByVal, a copy of the object is passed, and any changes to the copy do not affect the original object.

    Visual Basic (VB)

    • The Function keyword represents a block of code that returns a value.
    • The default data type for parameters in Visual Basic (VB) is Variant if not specified.
    • The Sub keyword signifies that a subroutine does not return a value.

    PL/I

    • A descriptor can provide information about the data type, length, and other attributes of an argument when passing arguments to a procedure.

    C++ Function Calls

    • The ampersand (&) signifies that a reference to a variable is being passed to a function, such as addTwo(&amp;v).

    C++ Function Types

    • A free function is a function that is not a member of a class, distinguishing it from a member function.

    Visual Basic (VB) Classes

    • A procedure represents a method or action that can be performed by an object when used in a class.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Learn about the GOSUB command in early BASIC variants, which allows control to jump to a specified line number in the code, execute a subroutine, and then resume execution at the next line. Explore how this feature influenced programming styles in early BASIC implementations.

    More Like This

    BASIC Programming Language History
    5 questions
    Basic Programming Concepts Quiz
    122 questions
    Introduction to BASIC Programming
    10 questions
    Use Quizgecko on...
    Browser
    Browser