1. What is the purpose of a constructor in a JavaScript class?
    A) To initialize object properties 
    B) To define methods 
    C) To inherit properties 
    D) To create static methods 
    Show Explanation 
    
 
    2. How do you access properties of an object using the `this` keyword?
    A) Using the object's name 
    B) Using 'this.propertyName' 
    C) Using 'self.propertyName' 
    D) Using 'current.propertyName' 
    Show Explanation 
    
 
    3. What does the `super` keyword do in a derived class?
    A) It creates a new instance 
    B) It calls the parent class constructor 
    C) It defines a new method 
    D) It accesses private properties 
    Show Explanation 
    
 
      
    4. Which of the following is a correct way to create a regular expression in JavaScript?
    A) /abc/ 
    B) new RegExp('abc') 
    C) 'abc' 
    D) Both A and B 
    Show Explanation 
    
 
    5. What method would you use to test if a string contains a specific pattern using regex?
    A) match() 
    B) search() 
    C) test() 
    D) find() 
    Show Explanation 
    
 
    6. How do you replace a substring in a string using a regular expression?
    A) replaceAll() 
    B) replace() 
    C) substitute() 
    D) modify() 
    Show Explanation 
    
 
    7. What does the regex pattern `/\d+/` match?
    A) One or more digits 
    B) One or more letters 
    C) One or more whitespace characters 
    D) A single character 
    Show Explanation 
    
 
    8. Which method returns an array of matches when using a regular expression?
    A) test() 
    B) match() 
    C) search() 
    D) replace() 
    Show Explanation 
    
 
    9. What does the `g` flag in a regex pattern do?
    A) Matches only the first occurrence 
    B) Ignores case sensitivity 
    C) Allows matching all occurrences 
    D) Restricts matches to a specific range 
    Show Explanation 
    
 
    10. Which character is used to denote the start of a line in a regex pattern?
    A) $ 
    B) *  
    C) . 
    D) ^ 
    Show Explanation 
    
 
    11. What will `instanceof` return if an object is an instance of a class?
    A) true 
    B) false 
    C) null 
    D) undefined 
    Show Explanation 
    
 
    12. Which keyword is used to create a new class in JavaScript?
    A) define 
    B) class 
    C) function 
    D) new 
    Show Explanation 
    
 
    13. What is a method in a JavaScript class?
    A) A function defined in a class 
    B) A variable defined in a class 
    C) A property of an object 
    D) A keyword in JavaScript 
    Show Explanation 
    
 
    14. What does the regex pattern `/^a/` match?
    A) Any string that starts with 'a' 
    B) Any string that ends with 'a' 
    C) Any string that contains 'a' 
    D) An empty string 
    Show Explanation 
    
 
    15. Which regex pattern would match any character except a newline?
    A) . 
    B) \n 
    C) \s 
    D) ^ 
    Show Explanation 
    
 
    16. What does the `i` flag do in a regex pattern?
    A) Makes the pattern case-insensitive 
    B) Matches only lowercase letters 
    C) Matches only uppercase letters 
    D) Ignores whitespace characters 
    Show Explanation 
    
 
    17. How do you match one or more whitespace characters in a regex pattern?
    A) \s 
    B) \s* 
    C) \s+ 
    D) \w+ 
    Show Explanation 
    
 
    18. Which method can be used to check if a string matches a regex pattern?
    A) test() 
    B) match() 
    C) search() 
    D) replace() 
    Show Explanation 
    
 
    19. What does the regex pattern `/[a-z]/` match?
    A) Any lowercase letter 
    B) Any uppercase letter 
    C) Any digit 
    D) Any special character 
    Show Explanation 
    
 
    20. How do you escape a special character in a regex pattern?
    A) Use a backslash (\) 
    B) Use a forward slash (/) 
    C) Use a caret (^) 
    D) Use a period (.) 
    Show Explanation