Which of the following statements is/are True ? P : C programming language has…

2018

Which of the following statements is/are True ?
P : C programming language has a weak type system with static types.
Q : Java programming language has a strong type system with static types.
Code :

  1. A.

    P only 

  2. B.

    Q only

  3. C.

    Both P and Q 

  4. D.

    Neither P nor Q

Attempted by 293 students.

Show answer & explanation

Correct answer: C

Answer: Both statements are true.

  • C: C is statically typed (types are determined at compile time) but is commonly described as weakly typed because it allows many implicit conversions (for example between integer and floating types), unrestricted pointer casts, and lacks many runtime type checks.

  • Java: Java is statically typed and generally considered strongly typed because it enforces stricter compile-time checks, requires explicit casts for many narrowing conversions, and performs runtime checks (for example, to prevent invalid casts between incompatible reference types).

  • Note: The terms "strong" and "weak" typing are informal and used relatively; both languages are statically typed, but C is usually seen as weaker compared with Java.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor