---
# System prepended metadata

title: Untitled

---

Logic Questions
1. The tallest mountain in the world was Kangchenjunga Mountain before Mt Everest. 
2. The weight of the cow needs to be reduced before it is safe to cross the bridge. For example, to remove any excess heavy load on the cow. Alternatively, the bridge needs to be reconstructed. 
3. If the largest number that can be write is only 2 numbers, then largest number that can be formed is by repeating it many times. For example 2 and 9, we can repeat it to 99999, with many 9 possible. 
4. One of the bulb will turn on and the other 2 will turn off when open the first switch. Then, continue with the second switch and see which is the second buld that will turn on and which other 2 turn off. The one remaining is for the third switch. 
5. Not sure
6. X+3-1=30; Hence, X=28. After climbing up 29 feet and sliding down 28 feet, the snail will be 1 foot away from the top of the well.So, it takes 29 hours to get out the well. 

Object Oriented Programming Corner
7.OOP is a computer programming model that organizes software design around data. 
8. Encapsulation, Abstraction, Polymorphism, Inheritance
9. A class defines the property(field) and behavior (method). Whereas objects are the specific instance that have have their own set of values. 
10. def check_status(input_value):
    if input_value < 0:
        return "Failed"
    elif input_value == 0:
        return "Pending"
    else:
        return "Success"

11. def my_function(*args):
    if len(args) == 1:
        print("Received string:", args[0])
    elif len(args) == 2:
        print("Received number:", args[0])
        print("Received DateTime:", args[1])
    else:
        print("Received parameters:", args)


12. public class User {
    private String name;
    private int age;
    private String birthDate;
    private String gender;

    public User(String name, int age, String birthDate, String gender) {
        this.name = name;
        this.age = age;
        this.birthDate = birthDate;
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getBirthDate() {
        return birthDate;
    }

    public String getGender() {
        return gender;
    }

    public String getUserSummary() {
        return "Name: " + name + ", Age: " + age;
    }

    public String getUserDetail() {
        return "Name: " + name + ", Age: " + age + ", Birth Date: " + birthDate + ", Gender: " + gender;
    }
}
13. public static int totalEvenNumbers(int[] arr) {
    int sum = 0;
    for (int num : arr) {
        if (num % 2 == 0) {
            sum += num;
        }
    }
    return sum;
}


SQL Corner
14. DELETE removes one role from the table whereas TRUNCATE removes all rows from a table. 
15. UNIONALL keeps all the records from the original dataset whereas UNION removes any duplicate records.
16. The IN operator is used to retrieves results when the specified value matches any value in a set of values or is returned by a subquery.Whereas EXISTS is a Boolean operator which checks the subquery result and returns an either TRUE or FALSE value. 
17. This is to get all the customer details whose occupation is either doctor, engineer or developer.

    SELECT * FROM customer
    WHERE occupation IN('Doctor', 'Engineer', 'Developer'); 
     
 This is to get all customer names and occupation who has placed at least one order
 
    SELECT name, occupation FROM customer
    WHERE EXISTS(SELECT * FROM Orders     
    WHERE customer.cust_id = Orders.cust_id)
18. It will always return 'Nope' even though it is  expected NULL = NULL to evaluate to TRUE.
19. Use INSERT INTO

Web Development Questions
20. GET method is used to retrieve data from a server, while the POST method is used to submit data to a server.
21. #red {
   color: red;
}
or

.red {
   color: red;
}


22. Accessing elements by ID: document.getElementById('id')

Accessing elements by class name: document.getElementsByClassName('classname')

Accessing elements using the name attribute: document.getElementsByName('name')


23. 73
24. True, this is because false == '0' where 'false' side is boolean whereas 0 is string,non boolean. The non boolean is forced to the boolean 'false'. So, it becomes false == false, which is true. 
    False
25. 1,4,3,2 
The timeout will delay 1000 milliseconds, then will log to 2. So, it will place in the last. Whereas, 3 will delay 0 milliseconds, then willonly log to 3. 
26. 1
    1
    0
    2
    || is OR operator, it returns the first true it encounter, and last if is false
    Whereas, && is AND operator, it returns last if is true and it returns the first faulty value it encounters. 
    



