Multiple choice technology programming languages

Identify the correct syntax for instantiating a class .

  1. testObj = CTest

  2. testObj = CTest()

  3. CTest testObj = CTest()

  4. testObj = new CTest()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Python instantiates classes using callable syntax: object_name = ClassName(). The parentheses are required to invoke the class constructor and create a new instance.