GATE | GATE-CS-2003 | Question 24

Which of the following statements is FALSE ?
(A) In statically typed language, each variable in a program has a fixed type
(B) In un-typed languages, values do not have any types
(C) In dynamically typed languages, variables have no types
(D) In all statically typed languages, each variable in a program is associated with values of only a single type during the execution of the program

Answer: (C)


This is an ambiguous question. “Untyped language” has no standard well-formulated definition, thus answering this question would be a bit difficult.

(A) Statically typed languages have one type associated to a variable, which is fixed once it has been deduced. Though, types could either be specified while code editing by the coder (Eg. C, Java), or it can be inferred at compile time (Eg. C++11, Haskell). Hence, after compile-time, every variable is bound to one fixed type, making this statement [TRUE]

(B) According to one definition, un-type languages store values in form of bits, thus neither variables nor values have any types associated to them. Hence this statement becomes [TRUE]

(C) Dynamically typed languages deduce types of values and bind them to the variables storing those values. Hence, values sure have fixed types, but variables don’t have fixed types bound to them. Although we can say that binding a type to a variable according to values makes them typeful, but they don’t have one fixed type. This statement has some ambiguity. [TRUE/FALSE]

(D) Same reason as of (A) [TRUE]

Hence, correct answer should be (C)


This solution is contributed by Vineet Purswani.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.