SSC General Science & Technology Sample Paper NCERT Sample Paper-6

  • question_answer
    Consider the following statements
    1. All expressions in static typing have their types determined prior to when the program is executed at compile-time.
    2. Dynamic typing is associated with runtime values rather than textual expressions. Which of the statements given above is/are correct?

    A)  Only 1 

    B)  Only 2

    C)  Both 1 and 2    

    D)  neither 1 nor 2

    Correct Answer: C

    Solution :

    [c] Static typed programming languages are those in which variables need not be defined before they're used. This implies that static typing has to do with the explicit declaration (or initialization) of variables before they're employed. Java is an example of a static typed language; C and C++ are also static typed languages. Note that in C (and C++ also), variables can be cast into other types, but they don't get converted; you just read them assuming they are another type. Dynamic typed programming languages are those languages in which variables must necessarily be defined before they are used. This implies that dynamic typed languages do not require the explicit declaration of the variables before they're used. Python is an example of a dynamic typed programming language, and so is PHP.

You need to login to perform this action.
You will be redirected in 3 sec spinner