Xii Computer Science - Function Ch -1

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 June Thirteen
J
June Thirteen
Community Contributor
Quizzes Created: 1 | Total Attempts: 81
Questions: 15 | Attempts: 81

SettingsSettingsSettings
Xii Computer Science - Function Ch -1 - Quiz

You have only 45 min to answer all questions.
You can refer your books however we advise you to remember your clock is ticking
Please aware you have negative marks for wrong answers
Good luck


Questions and Answers
  • 1. 

    What is a subroutine? (2 MARKS)

  • 2. 

    Differentiate pure and impure function (3 MARKS)

  • 3. 

    Explain the necessity of computer in human life (3 MARKS)

  • 4. 

    Explain with an example interface and implementation. (5 MARKS)

  • 5. 

    Explain what is a parameter with type and parameter without the type (2 marks)

  • 6. 

    The small sections of code that are used to perform a particular task is called

    • A.

      Subroutines

    • B.

      Files

    • C.

      Pseudo code

    • D.

      Modules

    Correct Answer
    A. Subroutines
    Explanation
    Subroutines are small sections of code that are used to perform a particular task. They are reusable and can be called multiple times within a program. Subroutines help in organizing code and making it more modular, as different tasks can be separated into different subroutines. This improves code readability, maintainability, and reusability. Therefore, the correct answer is Subroutines.

    Rate this question:

  • 7. 

    Which of the following is a unit of code that is often defined within a greater code structure?

    • A.

      Subroutines

    • B.

      Function

    • C.

      Files

    • D.

      Modules

    Correct Answer
    B. Function
    Explanation
    A function is a unit of code that is often defined within a greater code structure. It is a reusable block of code that performs a specific task and can be called or invoked from other parts of the code. Functions help in organizing and modularizing code, making it easier to read, understand, and maintain. They allow for code reusability and promote the concept of DRY (Don't Repeat Yourself) programming.

    Rate this question:

  • 8. 

    Which of the following is a distinct syntactic block?

    • A.

      Subroutines

    • B.

      Function

    • C.

      Modules

    • D.

      Definition

    Correct Answer
    D. Definition
    Explanation
    A distinct syntactic block refers to a section of code that is enclosed within a specific structure and can be treated as a single unit. Subroutines, functions, and modules are all programming constructs that can contain multiple lines of code, but they are not considered distinct syntactic blocks. On the other hand, a definition, such as a variable or constant declaration, is a self-contained unit that can be easily identified and separated from the rest of the code, making it a distinct syntactic block.

    Rate this question:

  • 9. 

    The variables in a function definition are called as

    • A.

      Subroutines

    • B.

      Definition

    • C.

      Parameters

    • D.

      Function

    Correct Answer
    C. Parameters
    Explanation
    The variables in a function definition are called parameters. Parameters are placeholders that allow us to pass values into a function when it is called. They define the input that a function expects and can be used within the function's body to perform operations or calculations. By using parameters, we can make our functions more flexible and reusable, as they can work with different values each time they are called.

    Rate this question:

  • 10. 

    The values which are passed to a function definition are called

    • A.

      Arguments

    • B.

      Subroutines

    • C.

      Function

    • D.

      Definition

    Correct Answer
    A. Arguments
    Explanation
    When we pass values to a function, these values are referred to as arguments. Arguments are used to provide input to the function and can be of any data type. The function then performs operations or calculations using these arguments and may return a result. In this context, the term "arguments" is the correct answer as it accurately describes the values passed to a function.

    Rate this question:

  • 11. 

    Which of the following are mandatory to write the type annotations in the function definition?

    • A.

      Curly braces

    • B.

      Parentheses

    • C.

      Square brackets

    • D.

      Indentations

    Correct Answer
    B. Parentheses
    Explanation
    Parentheses are mandatory to write the type annotations in the function definition. Type annotations are used in Python to specify the type of arguments and return values of a function. They are placed within parentheses after the function name and before the colon. This helps in providing clarity and ensuring type safety in the code.

    Rate this question:

  • 12. 

    Which of the following defines what an object can do?

    • A.

      Operating System

    • B.

      Compiler

    • C.

      Interface

    • D.

      Interpreter

    Correct Answer
    C. Interface
    Explanation
    An interface defines what an object can do by specifying a set of methods that the object must implement. It acts as a contract that enforces certain behaviors and functionality for objects that implement it. By using interfaces, we can achieve abstraction and polymorphism in object-oriented programming, allowing different objects to be treated interchangeably based on their shared interface.

    Rate this question:

  • 13. 

    Which of the following carries out the instructions defined in the interface?

    • A.

      Implementation

    • B.

      OS

    • C.

      Compiler

    • D.

      Interpreter

    Correct Answer
    A. Implementation
    Explanation
    The implementation is responsible for carrying out the instructions defined in the interface. The interface defines the contract or blueprint for how the instructions should be implemented, and the implementation is the actual code that fulfills those requirements. It is the implementation that executes the instructions and performs the desired actions or operations.

    Rate this question:

  • 14. 

    The functions which will give exact result when same arguments are passed are called

    • A.

      Impure functions

    • B.

      Partial Functions

    • C.

      Dynamic Functions

    • D.

      Pure functions

    Correct Answer
    D. Pure functions
    Explanation
    Pure functions are functions that always produce the same output for the same input, regardless of any external factors. They do not have any side effects and do not modify any variables outside their own scope. This makes them predictable and easier to test and debug. Impure functions, on the other hand, may produce different results for the same input due to their reliance on external factors or state. Partial functions and dynamic functions are not relevant to the concept of functions producing the exact result when the same arguments are passed.

    Rate this question:

  • 15. 

    The functions which cause side effects to the arguments passed are called

    • A.

      Partial Functions

    • B.

      Dynamic Functions

    • C.

      Impure function

    • D.

      Pure functions

    Correct Answer
    C. Impure function
    Explanation
    An impure function is a function that can modify or have side effects on the arguments passed to it. This means that when the function is called, it can change the values of the arguments, modify global variables, or perform any other actions that affect the state of the program. In contrast, pure functions do not have any side effects and only depend on their input parameters to produce a result. Therefore, the correct answer is impure function.

    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
  • Mar 30, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 27, 2020
    Quiz Created by
    June Thirteen
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.