Revision - 25/02/2023

ajith_56

AJITH D R

Posted on February 25, 2023

Revision - 25/02/2023

1.When do we use UNION operator in SQL?

We use UNION operator when we want to combine two or more SELECT statements. UNION also combines two or more tables into a single result set. UNION selects distinct rows and avoids duplicates.


2.What are the different subsets of SQL?

  • Data Definition Language (DDL): It allows you to perform various operations on the database such as CREATE, ALTER, and DELETE objects.
  • Data Manipulation Language(DML): It allows you to access and manipulate data. It helps you to insert, update, delete and retrieve data from the database.
  • Data Control Language(DCL): It allows you to control access to the database. Example – Grant, Revoke access permissions.

3.What are the difference between BCNF and 4NF?

In fourth normal form, there are no multi-valued dependencies of the tables, but in BCNF, there can be multi-valued dependency data in the tables.


4.If you are working on mutiple git branches how do we switch to a particular branch?

Check all the branches present in git reposiotry

git branch
Enter fullscreen mode Exit fullscreen mode

Switch to particular branch

git checkout <branchname>
Enter fullscreen mode Exit fullscreen mode

5.How do you change commit message of previous commit ?

git commit --amend -m '<commit message>'
Enter fullscreen mode Exit fullscreen mode

6.In linux, whenever we run a program, we give flags. Some use '-' and some use '--'. What is the difference ?

A single hyphen can be followed by multiple single-character flags. A double hyphen prefixes a single, multicharacter option.


7.What are block elements and inline elements in HTML?

  • Block-level elements are elements that take up the full width of their parent container and create a new line after the element.
  • Inline elements, on the other hand, are elements that only take up as much width as necessary and do not create a new line after the element.

8.What is the kernel and shell, and how are they related ?

  • The kernel is the core of the operating system that interacts directly with the hardware. The kernel is responsible for managing system processes, scheduling tasks, handling memory management, and managing device drivers.
  • The shell, on the other hand, is a user interface that allows users to interact with the operating system. It provides a command-line interface or graphical user interface (GUI) for users to run commands, launch applications, and manage files and directories.
  • The kernel and shell are both key components of an operating system. The kernel is responsible for managing system resources and interacting with the hardware, while the shell provides a user interface for users to interact with the operating system. They work together to manage the computer system and execute user commands and tasks.

9.What is the git command to see all the commits of a particular file?

git log --all <file_name>
Enter fullscreen mode Exit fullscreen mode

10.What is the use of "eq" dunder method in python ?

To change how Python checks if two things are equal using the "==" operator, we can create a special function in our class called "eq". This function will be called when we use the "==" operator on objects of our class. If we don't define this function, Python will use a default method that checks if two objects are stored in the same location in the computer's memory.


11.What is the difference between rem and em in CSS?

  • rem stands for "root em", and is always relative to the font-size of the root element (i.e., the html element). For example, if the font-size of the root element is set to 16px, then 1rem is equal to 16px. If the font-size of the root element is changed, then all rem values will be affected accordingly.
  • em stands for "element em", and is relative to the font-size of the element that the em value is applied to. For example, if a paragraph element has a font-size of 16px, then 1em is equal to 16px. If the font-size of a parent element is changed, then all em values inside that element will be affected accordingly.

12.What are mutable objects in python and what is the best way to identify them ?

  • Mutable objects can be changed after they are created.
  • The best way to identify whether an object is mutable or not is to try to modify it and see if the modification is reflected in the original object.
  • To identify whether an object is mutable or not, we can use the id() function in Python. The id() function returns a unique integer identifier for an object, which can be used to determine if two variables refer to the same object.
>>> my_list = [1, 2, 3]
>>> my_tuple = (1,2,3)
>>> print(id(my_list))
139941828301888
>>> print(id(my_tuple))
139941826669696
>>> my_list += [4,5,6]
>>> my_tuple += (4,5,6)
>>> print(id(my_list))
139941828301888
>>> print(id(my_tuple))
139941828542624
Enter fullscreen mode Exit fullscreen mode

We can see that the list identity is not changed, while the tuple identity is changed. This means that we have expanded our list, but created a completely new tuple.


13.Why we should not use multiple inheritance in software development ?

  • Complexity: Multiple inheritance can increase the complexity of a codebase. When a class inherits from multiple parent classes, it may be difficult to determine which parent's implementation of a method should be used in a particular scenario. This can lead to confusion and errors.
  • Diamond problem: The diamond problem is a common issue in multiple inheritance where a class inherits from two parent classes that both inherit from a common parent. This can lead to ambiguity in the inheritance hierarchy, making it difficult to determine which parent's implementation should be used.

14.What is the difference between strongly type and weakly typed language ?

  • In a strongly typed language, variables have a specific data type, and the language enforces strict rules about how variables of different types can be used. For example, in a strongly typed language like Java, we cannot assign a string value to an integer variable without first converting the string to an integer. The compiler will enforce this rule at compile-time, preventing type-related errors from occurring at runtime.

  • In a weakly typed language, variables are not required to have a specific data type, and the language may automatically convert between different data types as needed. For example, in a weakly typed language like JavaScript, we can assign a string value to a variable declared as an integer, and the language will automatically convert the string to an integer if possible.


15.What is the difference between statically typed and dynamically typed language?

  • Statically typed languages requires to declare the data type of a variable before it can be used. This means that the compiler can check the type of each variable at compile time, ensuring that only values of the correct type are assigned to each variable. Examples of statically typed languages include Java, C++, and C#.

  • Dynamically typed languages, on the other hand, do not require variables to be declared with a specific data type. Instead, the type of a variable is determined at runtime based on the value assigned to it. This allows for more flexibility in programming and can make the code easier to read and write. Examples of dynamically typed languages include Python, Ruby, and JavaScript.


16.How do you give space between flex items (CSS) ?

Using gap property. The gap property sets the gaps between rows and columns. It is a shorthand for row-gap and column-gap.

πŸ’– πŸ’ͺ πŸ™… 🚩
ajith_56
AJITH D R

Posted on February 25, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related