Computer Programming Languages For Beginners Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Thejoshwolfe
T
Thejoshwolfe
Community Contributor
Quizzes Created: 1 | Total Attempts: 423
Questions: 10 | Attempts: 423

SettingsSettingsSettings
Computer Programming Languages For Beginners Quiz - Quiz

You can easily cheat with the internet, so your score is only as honest as you are. Let's play this quiz and learn more about it!


Questions and Answers
  • 1. 

    Which of the following is NOT true?

    • A.

      A statement can contain statements.

    • B.

      An expression can contain expressions.

    • C.

      A statement can contain expressions.

    • D.

      An expression can contain statements.

    Correct Answer
    D. An expression can contain statements.
    Explanation
    An expression is a combination of variables, operators, and constants that evaluates to a value. It is a single unit that can be evaluated. On the other hand, a statement is a complete instruction that performs an action. It can include expressions, but it cannot contain other statements. Therefore, the statement "An expression can contain statements" is not true.

    Rate this question:

  • 2. 

    Scripting languages, by definition, require which of the following:

    • A.

      Control structures

    • B.

      Run-time interpretation

    • C.

      A host environment

    • D.

      A standard input and standard output api

    Correct Answer
    C. A host environment
    Explanation
    Scripting languages, such as JavaScript or Python, require a host environment to execute their code. This host environment provides the necessary resources and infrastructure for the scripting language to run. It includes components like a compiler or interpreter, libraries, and runtime environment. Without a host environment, the scripting language would not be able to execute its code properly. Therefore, a host environment is a requirement for scripting languages to function correctly.

    Rate this question:

  • 3. 

    IO in purely functional programming languages is typically accomplished through the use of

    • A.

      Monads

    • B.

      Heaps

    • C.

      Dijkstra's Algorithm

    • D.

      Eager evaluation

    Correct Answer
    A. Monads
    Explanation
    In purely functional programming languages, IO (Input/Output) operations are typically accomplished through the use of monads. Monads provide a way to encapsulate impure operations, such as reading from or writing to the console or files, within a pure functional context. By using monads, the effects of IO operations can be managed and controlled, ensuring that the overall program remains pure and free from side effects. Monads also enable composition of IO operations, allowing for more complex IO workflows to be expressed in a clear and concise manner.

    Rate this question:

  • 4. 

    The defining characteristic of a closure is the presence of a(n)

    • A.

      Anonymous function

    • B.

      First-class function

    • C.

      Bound variable

    • D.

      Reference to an immutable local variable in an enclosing function

    Correct Answer
    C. Bound variable
    Explanation
    A closure is a function that has access to variables from its outer scope, even after the outer function has finished executing. The defining characteristic of a closure is the presence of a bound variable, which is a variable that is declared in the outer function and is still accessible in the inner function. This bound variable is "bound" to the inner function, allowing it to be used even when the outer function is no longer in scope.

    Rate this question:

  • 5. 

    Algebraic Data Types are

    • A.

      Arbitrary precision numeric types

    • B.

      Tagged unions

    • C.

      Arrays

    • D.

      Unattainable

    Correct Answer
    B. Tagged unions
    Explanation
    Algebraic Data Types refer to a concept in programming languages where a type can have multiple possible values, each of which is defined by combining other types. Tagged unions, also known as sum types, are a specific implementation of Algebraic Data Types where a value can be one of several different types, and each possible type is tagged with a label. This allows for more expressive and flexible data structures, as they can represent a variety of different cases or states.

    Rate this question:

  • 6. 

    The "yield" keyword in Icon, XL, Ruby, Python 2.0, C# 2.0, and JavaScript 1.7 results in which of the following?

    • A.

      The use of a generator

    • B.

      The creation of an array

    • C.

      An OS-level context switch

    • D.

      The temporary release of a resource lock

    Correct Answer
    A. The use of a generator
    Explanation
    The "yield" keyword in programming languages such as Icon, XL, Ruby, Python 2.0, C# 2.0, and JavaScript 1.7 is used for the creation of a generator. A generator is a special type of function that can pause its execution and resume it later, allowing for the generation of a sequence of values. When the "yield" keyword is encountered, the current state of the function is saved, and the yielded value is returned. The function can then be resumed from where it left off, allowing for the generation of the next value in the sequence. This makes it useful for tasks such as iterating over large datasets or generating infinite sequences.

    Rate this question:

  • 7. 

    A first-class function is a

    • A.

      Function that takes no parameters

    • B.

      Function that takes functions as parameters

    • C.

      Function that is an object

    • D.

      Closure

    Correct Answer
    C. Function that is an object
    Explanation
    A first-class function is considered to be an object because it can be assigned to a variable, passed as an argument to other functions, and returned as a value from other functions. In programming, objects typically have properties and methods, and a first-class function can have properties and methods just like any other object. This allows for greater flexibility and functionality in the code, as the first-class function can be manipulated and used in various ways.

    Rate this question:

  • 8. 

    Between which two generations of programming languages is there no difference in run-time efficiency.

    • A.

      First & second

    • B.

      Second & third

    • C.

      Third & fourth

    • D.

      Fourth & fifth

    Correct Answer
    A. First & second
    Explanation
    The first and second generations of programming languages have no difference in run-time efficiency. This is because both generations relied on low-level programming languages like machine code and assembly language, which directly interact with the hardware. These languages allow for efficient execution of instructions, as they provide direct control over the computer's resources. In contrast, higher-level languages introduced in later generations focused more on productivity and ease of use, sacrificing some runtime efficiency. Therefore, the first and second generations share the same level of run-time efficiency.

    Rate this question:

  • 9. 

    Which of the following programming language families mandates a dynamic type system:

    • A.

      Scripting Languages

    • B.

      Functional Programming Languages

    • C.

      Declarative Programming Languages

    • D.

      None of the above

    Correct Answer
    D. None of the above
    Explanation
    The given question asks which programming language family mandates a dynamic type system. The options provided are Scripting Languages, Functional Programming Languages, Declarative Programming Languages, and None of the above. The correct answer is "None of the above" because none of the mentioned programming language families specifically mandate a dynamic type system. While scripting languages and some functional programming languages may commonly use dynamic type systems, it is not a requirement for all languages within these families. Similarly, declarative programming languages can use either dynamic or static type systems depending on the specific language implementation.

    Rate this question:

  • 10. 

    In Java, JavaScript, Python, and C# what is the result of executing the following pseudo code (translated into each languages respective syntax):try    throw exception1finally    throw exception2

    • A.

      Exception1 is thrown and exception2 is never thrown.

    • B.

      Exception1 is discarded and exception2 is thrown instead.

    • C.

      Exception2 is thrown up the call stack and handled appropriately, then then same for exception1.

    • D.

      Trick question. It's a compile error.

    Correct Answer
    B. Exception1 is discarded and exception2 is thrown instead.
    Explanation
    The given pseudo code uses a try-finally block, which guarantees that the code in the finally block will always be executed, regardless of whether an exception is thrown or not. In this case, exception1 is thrown within the try block, but since there is a finally block, it will still be executed. However, when the finally block is executed, it throws exception2, which replaces exception1. Therefore, exception1 is discarded and exception2 is thrown instead.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Sep 18, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 05, 2009
    Quiz Created by
    Thejoshwolfe
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.