Trending December 2023 # Comprehensive Guide For Interview Questions On Transfer Learning # Suggested January 2024 # Top 19 Popular

You are reading the article Comprehensive Guide For Interview Questions On Transfer Learning updated in December 2023 on the website Tai-facebook.edu.vn. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 Comprehensive Guide For Interview Questions On Transfer Learning

This article was published as a part of the Data Science Blogathon.

Source: Canva

Introduction

In this article, I have compiled a list of twelve important questions on Transfer Learning that you could use as a guide to get more familiar with the topic and also formulate an effective answer to succeed in your next interview.

Interview Questions on Transfer Learning

Following are some interview-winning questions with detailed answers on Transfer Learning.

Question 1: What is Transfer Learning in NLP? Explain with Examples.

Answer: Transfer Learning is an ML approach where a model trained for a source task is repurposed for other related tasks (target task).

Usually, models are developed and trained to perform isolated tasks. However, to leverage our resources well and cut down the training time, the knowledge gained from a model used in one task (source task) can be reused as a starting point for other related tasks (target tasks).

The more related the tasks, the easier it is for us to transfer or cross-utilize our knowledge. Some simple examples would be:

In essence, Transfer Learning is inspired by human beings’ capability to transfer/leverage/generalize knowledge gathered from a related domain (source domain) to improvize the learning performance of the target domain task. Let’s understand this with the help of the following examples:

Example 1: Let’s say you know how to play Xiangqi, and now if you want to learn how to play Chess, given the overlap, it would be easier for you to learn given that you can apply/generalize the knowledge of Xiangqi while learning/playing Chess and learn quickly.

Example 2: Assume you know how to play the violin, so at least some amount of knowledge (i.e., musical notes/nuances, etc.) that you gathered while playing/learning and understanding the violin could be applied in learning how to play piano and learn quickly.

Example 3: Similarly, if you are well-versed in riding a bicycle, it would be beneficial to leverage that “knowledge/experience” while trying to learn how to ride a scooter/bike.

We don’t learn everything from the outset in each of these scenarios. We cross-transfer and apply/generalize knowledge from what we have learned in the past!

Figure 1: We can infer intuitive examples of transfer learning   (Source: Arxiv)

During transfer learning, the application of knowledge refers to leveraging the source task’s attributes and characteristics, which are applied and mapped onto the target task.

Figure 2: Illustration of Transfer Learning where knowledge could be in the form of instances/features/parameters/relations (Source: Arxiv)

During transfer learning, the base of a pre-trained model (that has already learned to do 1) is reused, and an untrained head having a few dense layers is attached (to learn 2). The body weights learn broad source domain features, which are used to initialize a new model for the new target task.

Figure 3: Traditional supervised learning (left) Vs. Transfer Learning (right) (Source: NLP with Transformers book)

Note: The applied knowledge does not necessarily have a beneficial effect on new tasks. We will take a look at this in Question 9.

Question 2: Why Should We Use Transfer Learning?

Answer: When the target task is little related to the source domain + task, it’s recommended to leverage Transfer Learning since it can help us in the following aspects:

1. Saves Time: Training a large model from scratch takes a lot of time, from a few days to weeks. This need can be curtailed by leveraging the pre-trained model (source model) knowledge.

2. Saves Resources + Economical + Environment Friendly: Since it doesn’t involve training the model right from the outset. As a result, it saves resources and is economical and environment-friendly.

3. Helps in building effective models when labeled data is scarce: In scenarios where we have very little data at our disposal, with the help of transfer learning, an effective machine learning model can be built using little training data.

4. Better Performance: During the positive transfer, it often yields better results than a model trained using supervised learning from scratch.

Figure 4: Effect of Transfer Learning on the performance of the model (Source: Machine Learning Mastery)

Question 3: List the Different Types of Transfer Learning.

Answer: Transfer Learning can be classified based on Problem and Solution. The following diagram pretty much sums up everything.

Figure 5: Types of Transfer Learning (Source: Arxiv)

1. Problem Categorization:

Label-Setting-Based Categorization:

Transductive Transfer Learning

Inductive Transfer Learning

Unsupervised Transfer Learning

Space-Setting-Based Categorization:

Homogeneous Transfer Learning

Heterogenous Transfer Learning

2. Solution Categorization:

Instance-based Approach

Feature-based Approach

Parameter-Based Approach

Relational-Based Approach

Question 4: Explain More about Label-Setting-Based Transfer Learning Categorization.

Answer: As we briefly discussed before, based on label-setting, Transfer Learning can be classified as follows:

Transductive Transfer Learning

Inductive Transfer Learning

Unsupervised Transfer Learning

Figure 6: Graphical illustration of Label-setting-based Transfer Learning (Source: Arxiv)

a) Inductive Transfer Learning: In this, the source and target domains are the same. However, the source and target tasks are still different from one another.

The model uses inductive biases from the source task to help improve the performance of the target task.

Depending on whether the source task domain has labeled data or not, inductive transfer learning can be further classified as Multi-task Learning and Self-taught Learning (Sequential Learning).

Figure 7: Types of Inductive Transfer Learning (Source: Arxiv)

b) Transductive Transfer Learning: In this, the source and the target tasks share similarities. However, the corresponding domains are different.

In this, the source domain has a lot of labeled data, while the target domain doesn’t have labeled data, or if it has, then the labeled samples are very few.

Transductive Transfer Learning can be further classified into Domain Adaptation and Cross-lingual learning.

Figure 8: Types of Transductive Transfer Learning (Source: Arxiv)

c) Unsupervised Transfer Learning:

Unsupervised Transfer Learning is very similar to Inductive Transfer Learning.

Despite the source and target domain similarity, the source and target tasks differ.

Question 5: What is Sequential Transfer Learning? Explain its Types.

Sequential transfer learning can be further divided into the following four categories:

Fine-tuning

Adapter modules

Feature-based

Zero-shot

1. Fine-tuning: A given pretrained model (M) with weights W is used to learn a new function f that maps the parameters f(W) = W’. The parameters can be changed on all layers or just a select few. Moreover, the learning rate could be different for the different layers.

Fine-tuning a pre-trained model on a massive semi-related dataset proved to be a simple and effective approach for many problems.

2. Adapter modules: A given pre-trained model with weights W is initialized with a new set of parameters less in magnitude than W.

sentence, or paragraph embeddings. The set of embeddings (E) from model M is kept unchanged.

4. Zero-shot: Given a pretrained model M with W, no training procedure is applied to optimize/learn new parameters.

Question 6: What is Multi-task Learning?

Answer: Multi-Task Learning is the process of learning multiple tasks simultaneously. For example, for a given pretrained model M, the learning is transferred to multiple tasks (T1, T2, · · ·, Tn).

Figure 9: Multi-task Learning (Source: Author)

Question 7: What is Domain Adaptation?

Answer: Domain adaptation is adapting the source task to a new target domain. This is typically used when we want the model to learn a different data distribution in the target domain. For example, a review could be written on hospitals in the first domain (source domain) while on clinics in the second domain (target domain).

Domain adaptation is beneficial when the new training task has a different distribution or when we have very little data.

Figure 10: Diagram illustrating the Domain Adaptation wherein the source task having a certain data distribution is adapted to target domain of different data distribution (Source: Author)

Question 8: What does Cross-lingual Learning Mean?

Answer: Cross-lingual learning adapts the source task to a different language in the target domain. This is beneficial when we leverage a high-resource language to learn corresponding tasks in a low-resource language setting. For example, a model trained for the Spanish language could be fine-tuned on the French language dataset, which doesn’t ensure a positive transfer.

Figure 11: Diagram illustrating cross-lingual learning  (Source: Author)

Question 9: Does Transfer Learning Always Improve the Results?

Answer: No. Sometimes the transfer method negatively affects the performance of the new target task, called a “Negative Transfer.” This usually happens when the source and target tasks are not similar enough, which causes the first round of training to be very far off.

Algorithms don’t always concur with what we see as similar, making it challenging to understand the fundamentals and standards of what type of training is sufficient.

Hence, while working with the transfer learning method, one of the key challenges is ensuring a positive transfer between related tasks whilst preventing the negative transfer between less related tasks.

For example, learning to ride a bicycle cannot help us learn to play the violin quickly.

Figure 11: Diagram illustrating knowledge transfer between unrelated domains/tasks

Moreover, the similarity between the domains doesn’t ensure that the knowledge transfer will facilitate learning. Sometimes the similarities between the domains can be deceptive.

For example, despite Spanish and French being Neo-Latin languages with a close relationship, people who learn Spanish may have trouble learning French, like using the wrong vocabulary or conjugation. This happens because learning the word formation, usage, pronunciation, conjugation, etc., in French can be hindered by previous successful familiarity with the language in Spanish.

Question 10: What Should we do When we have the Target Dataset Similar to the Base Network Dataset?

Answer: So, it depends on if the target dataset is small or large.

Case 1:The target dataset is small + similar to the base network dataset: Given that the training dataset is small, the pre-trained network can be fine-tuned with the target dataset. However, this may lead to overfitting. Moreover, the target dataset might also have different classes, which may change the number of classes in the target task. In such cases, one or two fully connected layers are removed from the end, and a new fully connected layer satisfying the number of new classes is added. Now, only these newly added layers are trained, and the rest of the model is frozen.

Case 2:The target dataset is huge + similar to the base network dataset: Given that we have enough data at our disposal, the last full-connected layer is removed, and a new fully-connected layer is added with the appropriate number of classes. Now, the entire model is trained on the target dataset. This ensures the model is tuned while maintaining the same architecture on a new large dataset (target dataset).

Figure 12: Diagram illustrating different scenarios when the target dataset is similar to the dataset of the base network

Question 11: What Should we do When we have a Target Dataset Different from a Base Network Dataset?

Answer: Again, it depends on if the target dataset is small or large.

Case 1: The target dataset is small + different from the base network dataset: Given that the target dataset is different, leveraging the high-level features of the pre-trained model will not help. Rather, most of the layers from the end in a pre-trained model should be removed, and then new layers satisfying the number of classes in the new (i.e., target) dataset should be added. This way, the low-level features from the pre-trained models can be leveraged, and the rest of the layers could be trained to fit the new dataset. Sometimes training the whole network after adding a new layer at the end is beneficial.

Case 2: The target dataset is huge + different from the base network dataset: Given that the target dataset is large and different from the source domain/task, the optimal approach would be to eliminate the last layers from the pre-trained model, and new layers with the appropriate number of classes should be added, then the whole network should be trained without freezing any layer.

Question 12: What Key Things Must be Considered During Transfer Learning?

Answer: During the process of transfer learning, the following key questions need to be addressed:

Figure 13: Key things that must be considered during the process of transfer learning

What to Transfer: This is the first and most crucial step in the whole process. To improve the effectiveness of the target task, it needs to be determined which part of the knowledge is source-specific and what the source and the target have in common.

When to Transfer: As we discussed, knowledge transfer sometimes reduces target task performance (also called a negative transfer). This usually happens when the source and target domains/tasks are not similar. We should aspire to use transfer learning in such a way that it improves the target task performance and does not degrade them. Hence, when to transfer and when not to transfer should be carefully considered.

How to Transfer: Once the what and how have been determined, we estimate how to transfer the knowledge across domains/tasks. This involves tweaking the existing algorithms and different techniques.

Lastly, the model’s input must be the same size it was primarily trained with. If that is not like that, a preprocessing step must be added to resize the input.

Conclusion

This article covers the twelve most important interview-winning questions. Using these interview questions as a guide, you can better understand the fundamentals of the topic and formulate an effective answer and present it to the interviewer.

In transfer learning, the knowledge gained from a model used in the source task can be reused as a starting point for other related target tasks.

Transfer Learning saves training time and resources and helps build competitive models even when labeled data is scarce.

Sequential Transfer Learning is the process of learning multiple tasks sequentially. Let’s say the knowledge needs to be transferred to multiple tasks (T1, T2, …. Tn).

Fine-tuning a pre-trained model on a massive semi-related dataset proved to be a simple and effective approach for many problems.

Multi-Task Learning is the process of learning multiple tasks at once in parallel. For example, for a given pretrained model M, the learning is transferred to multiple tasks (T1, T2, · · ·, Tn).

During the negative transfer, we witness degradation in the performance of the model.

During transfer learning, we must consider what to transfer, when, and how to transfer. Moreover, the model’s input must be the same size it was primarily trained with.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.

Related

You're reading Comprehensive Guide For Interview Questions On Transfer Learning

50 Machine Learning Interview Questions And Answers (2023)

Here are Machine Learning interview questions and answers for fresher as well as experienced candidates to get their dream job.

1) What is Machine learning?

Machine learning is a branch of computer science which deals with system programming in order to automatically learn and improve with experience. For example: Robots are programed so that they can perform the task based on data they gather from sensors. It automatically learns programs from data.

2) Mention the difference between Data Mining and Machine learning?

Machine learning relates with the study, design and development of the algorithms that give computers the capability to learn without being explicitly programmed. While, data mining can be defined as the process in which the unstructured data tries to extract knowledge or unknown interesting patterns. During this process machine, learning algorithms are used.

3) What is ‘Overfitting’ in Machine learning?

In machine learning, when a statistical model describes random error or noise instead of underlying relationship ‘overfitting’ occurs. When a model is excessively complex, overfitting is normally observed, because of having too many parameters with respect to the number of training data types. The model exhibits poor performance which has been overfit.

4) Why overfitting happens?

The possibility of overfitting exists as the criteria used for training the model is not the same as the criteria used to judge the efficacy of a model.

5) How can you avoid overfitting?

By using a lot of data overfitting can be avoided, overfitting happens relatively as you have a small dataset, and you try to learn from it. But if you have a small database and you are forced to come with a model based on that. In such situation, you can use a technique known as cross validation. In this method the dataset splits into two section, testing and training datasets, the testing dataset will only test the model while, in training dataset, the datapoints will come up with the model.

In this technique, a model is usually given a dataset of a known data on which training (training data set) is run and a dataset of unknown data against which the model is tested. The idea of cross validation is to define a dataset to “test” the model in the training phase.

6) What is inductive machine learning?

The inductive machine learning involves the process of learning by examples, where a system, from a set of observed instances tries to induce a general rule.

7) What are the five popular algorithms of Machine Learning?

Decision Trees

Neural Networks (back propagation)

Probabilistic networks

Nearest Neighbor

Support vector machines

8) What are the different Algorithm techniques in Machine Learning?

The different types of techniques in Machine Learning are

Supervised Learning

Unsupervised Learning

Semi-supervised Learning

Reinforcement Learning

Transduction

Learning to Learn

9) What are the three stages to build the hypotheses or model in machine learning?

Model building

Model testing

Applying the model

10) What is the standard approach to supervised learning?

The standard approach to supervised learning is to split the set of example into the training set and the test.

11) What is ‘Training set’ and ‘Test set’?

In various areas of information science like machine learning, a set of data is used to discover the potentially predictive relationship known as ‘Training Set’. Training set is an examples given to the learner, while Test set is used to test the accuracy of the hypotheses generated by the learner, and it is the set of example held back from the learner. Training set are distinct from Test set.

12) List down various approaches for machine learning?

The different approaches in Machine Learning are

Concept Vs Classification Learning

Symbolic Vs Statistical Learning

Inductive Vs Analytical Learning

13) What is not Machine Learning?

Artificial Intelligence

Rule based inference

14) Explain what is the function of ‘Unsupervised Learning’?

Find clusters of the data

Find low-dimensional representations of the data

Find interesting directions in data

Interesting coordinates and correlations

Find novel observations/ database cleaning

15) Explain what is the function of ‘Supervised Learning’?

Classifications

Speech recognition

Regression

Predict time series

Annotate strings

16) What is algorithm independent machine learning?

Machine learning in where mathematical foundations is independent of any particular classifier or learning algorithm is referred as algorithm independent machine learning?

17) What is the difference between artificial learning and machine learning?

Designing and developing algorithms according to the behaviours based on empirical data are known as Machine Learning. While artificial intelligence in addition to machine learning, it also covers other aspects like knowledge representation, natural language processing, planning, robotics etc.

18) What is classifier in machine learning?

A classifier in a Machine Learning is a system that inputs a vector of discrete or continuous feature values and outputs a single discrete value, the class.

20) In what areas Pattern Recognition is used?

Pattern Recognition can be used in

Computer Vision

Speech Recognition

Data Mining

Statistics

Informal Retrieval

Bio-Informatics

21) What is Genetic Programming?

Genetic programming is one of the two techniques used in machine learning. The model is based on the testing and selecting the best choice among a set of results.

22) What is Inductive Logic Programming in Machine Learning?

Inductive Logic Programming (ILP) is a subfield of machine learning which uses logical programming representing background knowledge and examples.

23) What is Model Selection in Machine Learning?

The process of selecting models among different mathematical models, which are used to describe the same data set is known as Model Selection. Model selection is applied to the fields of statistics, machine learning and data mining.

24) What are the two methods used for the calibration in Supervised Learning?

The two methods used for predicting good probabilities in Supervised Learning are

Platt Calibration

Isotonic Regression

These methods are designed for binary classification, and it is not trivial.

25) Which method is frequently used to prevent overfitting?

When there is sufficient data ‘Isotonic Regression’ is used to prevent an overfitting issue.

26) What is the difference between heuristic for rule learning and heuristics for decision trees?

The difference is that the heuristics for decision trees evaluate the average quality of a number of disjointed sets while rule learners only evaluate the quality of the set of instances that is covered with the candidate rule.

27) What is Perceptron in Machine Learning?

In Machine Learning, Perceptron is a supervised learning algorithm for binary classifiers where a binary classifier is a deciding function of whether an input represents a vector or a number.

28) Explain the two components of Bayesian logic program?

Bayesian logic program consists of two components. The first component is a logical one ; it consists of a set of Bayesian Clauses, which captures the qualitative structure of the domain. The second component is a quantitative one, it encodes the quantitative information about the domain.

29) What are Bayesian Networks (BN)?

Bayesian Network is used to represent the graphical model for probability relationship among a set of variables.

30) Why instance based learning algorithm sometimes referred as Lazy learning algorithm?

Instance based learning algorithm is also referred as Lazy learning algorithm as they delay the induction or generalization process until classification is performed.

31) What are the two classification methods that SVM ( Support Vector Machine) can handle?

Combining binary classifiers

Modifying binary to incorporate multiclass learning

32) What is ensemble learning?

To solve a particular computational program, multiple models such as classifiers or experts are strategically generated and combined. This process is known as ensemble learning.

33) Why ensemble learning is used?

Ensemble learning is used to improve the classification, prediction, function approximation etc of a model.

34) When to use ensemble learning?

35) What are the two paradigms of ensemble methods?

The two paradigms of ensemble methods are

Sequential ensemble methods

Parallel ensemble methods

36) What is the general principle of an ensemble method and what is bagging and boosting in ensemble method?

The general principle of an ensemble method is to combine the predictions of several models built with a given learning algorithm in order to improve robustness over a single model. Bagging is a method in ensemble for improving unstable estimation or classification schemes. While boosting method are used sequentially to reduce the bias of the combined model. Boosting and Bagging both can reduce errors by reducing the variance term.

37) What is bias-variance decomposition of classification error in ensemble method?

The expected error of a learning algorithm can be decomposed into bias and variance. A bias term measures how closely the average classifier produced by the learning algorithm matches the target function. The variance term measures how much the learning algorithm’s prediction fluctuates for different training sets.

38) What is an Incremental Learning algorithm in ensemble?

Incremental learning method is the ability of an algorithm to learn from new data that may be available after classifier has already been generated from already available dataset.

39) What is PCA, KPCA and ICA used for?

PCA (Principal Components Analysis), KPCA ( Kernel based Principal Component Analysis) and ICA ( Independent Component Analysis) are important feature extraction techniques used for dimensionality reduction.

40) What is dimension reduction in Machine Learning?

In Machine Learning and statistics, dimension reduction is the process of reducing the number of random variables under considerations and can be divided into feature selection and feature extraction.

41) What are support vector machines?

Support vector machines are supervised learning algorithms used for classification and regression analysis.

42) What are the components of relational evaluation techniques?

The important components of relational evaluation techniques are

Data Acquisition

Ground Truth Acquisition

Cross Validation Technique

Query Type

Scoring Metric

Significance Test

43) What are the different methods for Sequential Supervised Learning?

The different methods to solve Sequential Supervised Learning problems are

Sliding-window methods

Recurrent sliding windows

Hidden Markow models

Maximum entropy Markow models

Conditional random fields

Graph transformer networks

44) What are the areas in robotics and information processing where sequential prediction problem arises?

The areas in robotics and information processing where sequential prediction problem arises are

Imitation Learning

Structured prediction

Model based reinforcement learning

45) What is batch statistical learning?

Statistical learning techniques allow learning a function or predictor from a set of observed data that can make predictions about unseen or future data. These techniques provide guarantees on the performance of the learned predictor on the future unseen data based on a statistical assumption on the data generating process.

46) What is PAC Learning?

PAC (Probably Approximately Correct) learning is a learning framework that has been introduced to analyze learning algorithms and their statistical efficiency.

47) What are the different categories you can categorized the sequence learning process?

Sequence prediction

Sequence generation

Sequence recognition

Sequential decision

48) What is sequence learning?

Sequence learning is a method of teaching and learning in a logical manner.

49) What are two techniques of Machine Learning?

The two techniques of Machine Learning are

Genetic Programming

Inductive Learning

50) Give a popular application of machine learning that you see on day to day basis?

The recommendation engine implemented by major ecommerce websites uses Machine Learning.

These interview questions will also help in your viva(orals)

Basic Interview Questions On Computer Architecture

This article was published as a part of the Data Science Blogathon.

Introduction

this article, we will discuss some questions on Computer Architecture that are important from the perspective of interviews and college examinations.

Computer Architecture means how a computer is interconnected with its hardware components and how they transfer data. Various methods and hardware have increased these computers’ processing speed and efficiency.

History of Computers

1. Charles Babbage: Conceptualization and implementation of the first mechanical computer (1 s 5 tons, and its length is 11 feet

2. The first electronic digital programmable computer, Colossus, was invented in 1943. It uses Vacuum Tubes to process the information.

3. the First programmable electronic computer called ENIAC was invented in 1945. It weighs about 80 tons, and it contains about 18000 vacuum tubes.

Fig. 1 Basic Computer Architecture

Why should we study Computer Architecture?

Below are some reasons why it is beneficial for us to gain knowledge of computer architecture. It helps us to write fast and efficient code. Also, it allows us to identify the proper hardware which fulfills our computational demands.

1. Write better programs

a) Faster

b) Smaller

c) Less power consuming (fewer computations involved)

2. To make suitable design choices for changing needs and evolving technologies

a) GPU

b) Wearable

c) Datacenter

d) Mobile phones

e) Quantum computing etc.

Outcomes of learning Computer Architecture:

1. Understanding of the essential components and the design of a computer,

2. Understanding the functional aspects of different components

3. Identification of the issues involved in the instruction execution

4. Identification and analysis of the issues related to performance improvement

5. Analysis of system requirements

Interview Questions on Computer Architecture

Serial Bus: It is a bus that transfers data bit by bit over a single channel. It periodically transmits data to avoid a collision.

Parallel Bus: It is a bus that parallelly transmits bits over multiple channels. As more than one channel is used, there is no chance of collision.

Serial Bus Parallel Bus

 It transfers more bits per I/O cycle.

Less Cost.  It transfers data with more speed as compared to the serial bus.

It also has fewer pins, making it less complicated.  It has a high update rate, so it could be beneficial where the update rate of bits must be increased.

Serial Bus Parallel Bus

Slower Rate of data transfer. More complexity on the motherboard due to more pins.

Slower bit update rate. Higher Cost

It requires all the bits of the multibyte register, which must be loaded one at a time. It only supports short-distance communication due to cross-talk between parallel lines.

Q2. Explain the differences between Von Neumann and Harvard architectures.

Von Neuman Architecture Harvard Architecture

This same memory is used for storing instructions and data. In this, separate memories are used for storing instructions and data.

Due to the single memory, it has a cheaper cost. Due to multiple memories, it has a higher cost.

The CPU can not simultaneously read and write the instructions and data as a single memory. Due to multiple memories, the CPU can read and write the instructions and data simultaneously.

We can commonly find Von-Neuman Architecture in personnel computers. Harvard Architecture is typical in microcontrollers and signal processing.

Below is the diagrammatic explanation of this two architecture

Fig. 2 Von Neumann V/S Harvard Architecture

The Stored Program Concept is similar to Von-Neuman Architecture. In this, both the instructions and data are stored in the same memory. And before this concept, the instructions and data are stored in two separate memories, entirely different entities (e.g., Harvard Architecture). Below is the figure which shows where this store program concept is used.

It only uses single memory, that’s why its manufacturing cost is significantly less. Also, a single data bus is used to fetch both data and instructions, which reduces its cost furthermore. By using this concept, we can sequentially perform various tasks. Also, it provides high processing power due to only a single memory.

Q4. Explain the role of the instruction set architecture as a layer of abstraction. How is system software different from application software?

Instruction set architecture acts as an interface between hardware and software. Provides commands to the processor to tell it what it needs to do. Instruction set architecture is the machine’s portion visible to the assembly language programmer. Also, it is the only way to interact with the hardware.

System Software Application Software

It is written in assembly language. It is written in High-Level Languages.

They are general-purpose software. They are made for specific purposes and functions.

They can run independently of application software. They need System Software to run.

It works as an interface between Application Software and System. It works as an interface between the Application Software and the User.

Users cannot interact with it. Users can interact with it and give them commands.

E.g., Operating Systems E.g., MS Word

Q5 “The clock rate of a computer may be arbitrarily increased to achieve faster execution by the CPU” – Do you agree with this statement? Explain.

No, we cannot increase the clock rate of a computer to a value to achieve high computations arbitrarily. Because improving the clock rate arbitrarily can increase the cost of the issues and lead to severe heating issues.

CPU execution time = (Number of instructions × CPI)(1/clock rate)

From the above equation, we can see that if the clock rate is inversely proportional, the execution time will decrease and vice-versa. If the pulse is high, given that the circuit is slow, it might be possible that the course is triggered by the next clock pulse, leading to the wrong result.

Q6. Is Moore’s Law still valid? Do you think that it will remain steadfast in the future? If not, what will be the possible reasons for its failure?

Moore’s Law is invalid nowadays because we cannot double the number of transistors every two years. According to a study, the growth rate of the number of transistors is less than 30% annually. Using standard silicon technology, computing power cannot maintain its rapid exponential growth.

In the future, the original Moore’s Law will not be valid. It will probably be replaced or modified according to the needs of quantum computation.

Reasons for the failure of Moore’s Law:

1. Currently, the transistors are soo small that we cannot reduce their size further. Now, Apple is making micro-chips of size 7nm, which is even minor in the thickness of hair.

2. The main reasons blocking Moore’s Law are Heating and Leakage.

3. Artificial Intelligence and Machine Learning have augmented Moore’s Law over time.

4. The upcoming era is Quantum Computing which has an entirely different structure and is based on nano-biotechnology. It will be the end of the silicon age.

Q7. Consider the following table.

Clock Cycles

ALU Instructions 50% 4

Load Instructions 30% 5

Store Instructions 10% 4

Branch Instructions 10% 2

Ans:

1) CPI is the average clock cycle required per instruction.

Therefore, CPI

= (50/100)×4 + (30/100)×5 + (10/100)×4 + (10/100)×2

= 4.1

2) CPU executing time = (No. of instructions)*CPI/frequency

Number of instructions = 3 × 106 {Given}

CPI = 4.1 {As calculated above}

Clock rate = 2 × 109 Hz {Given}

Therefore,

CPU execution time = (Number of instructions × CPI)(1/clock rate)

= (3 × 106 × 4.1)(1 / 2 × 109)

= 6.15 × 10-3s

3) Overall speedup (S0) = 1.5 {Given}

p = 0.5 {Given}

S = speedup {To find}

Further,

According to Amdahl’s Law, the Overall SpeedUp is given by-

S0 = 1(1 – p)+p/S                 {So is the overall speedup}

1.5 = 1(1 – 0.5)+(0.5/S)

Thus,

S = 3

Therefore, Speedup of ALU instruction is 3

In the first scheme, we will do the 1’s complement, but in the 2nd scheme, we will do the 2’s complement to increase the speed to the desired value.

Conclusion

In this article, we have discussed various essential questions about Computer Networks for Interview preparation.

There are also various topics in computer architecture, like the Arithmetic Logic Unit, which is responsible for all the arithmetic and logic operations on data processed by a computer. Also, the circuitry must be able to perform all the arithmetic and logic operations included in the instruction set.

Also, Control Units and Registers are some crucial topics I will discuss in subsequent blogs.

Currently, there is a massive demand for computer architecture engineers. So if you want to pursue this field, it is very high time. You get numerous resources online free of cost that will help you to master this skill.

4. Talk about Clock Rate, System Software, and Application Software.

It is all for today. I hope that you have enjoyed reading that article.

See you again 😊

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.

Related

25 Essential Computer Science Interview Questions {Updated For 2023}

Introduction to Computer Science Interview Questions and Answers

So you have finally found your dream job in Computer Science but are wondering how to crack the 2023 Computer Science interview and what could be the probable Computer Science Interview Questions. Every Computer Science interview is different, and the job scope is different too. Keeping this in mind, we have designed the most common  Computer Science interview Questions and answers to help you get success in your interview.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

1. What is a file?

A file is a named location that stores data or information permanently. A file is always stored inside a storage device using a file name (e.g., STUDENT.MARKS). A file name typically has a primary and secondary name separated by a “.” (DOT).

2. What is a class?

A class is a blueprint from which objects are created. A class contains methods and variables associated with an instance of a class.

3. What is an object?

}

4. What is a constructor?

A constructor is a method used to create an Object of a class. There are two types of constructor Default & Parameterized constructor.

5. What is the different OOPS principle?

The basic OOPS principle are as follows,

Encapsulation

Abstraction

Inheritance

Polymorphism

6. What is inheritance?

}

7. What is polymorphism?

Polymorphism is the ability of an object to take on multiple forms. Polymorphism is commonly used in OOP when a parent class reference refers to a child class object.

8. What are the instance and class variables?

}

9. Compare the method and constructor?

Method: Used to perform some function or operation.

Method: Has a return type.

10. What is a singleton class? 11. What are the steps for creating the object?

Abc a= new Abc();

12. What is the different type of access modifiers?

• Protected – Visible to package and subclass.

13. Which is the highest operator precedence in Java

The operator with the highest preference is the Postfix operator, i.e. () [].

14. What is an array?

The array is a container with a fixed number of similar data types.

15. What is the difference between equals() and method and == operator?

The equals() is a method that matches the content of the strings, whereas == is an operator and matches the object or reference of the strings.

16. Is string class final?

Yes

17. What is a wrapper class?

To access the primitive data type as an object, we use the wrapper class. They are the following:-

Primitive Type Wrapper class

boolean Boolean

char Character

byte Byte

short Short

int Integer

long Long

float Float

double Double

18. What is the difference between overloading and overriding? 19. What are multiple inheritances in Java?

Java supports multiple inheritances, i.e., the ability of a class to implement more than one Interface. A class can implement multiple Interfaces but cannot extend multiple classes.

20. What is a stream?

Output Stream: Used to write data into a destination.

21. What is a Character stream?

Java Character stream is used to perform input and output for 16-bit Unicode. The main classes users are FileReader and FileWriter, which internally uses FileInputStream and FileOutputStream, so the basic difference is that FileReader and FileWriter read and write two bites at a time, respectively.

22. What is a Byte stream?

The main classes related to byte streams are FileInputStream and FileOutputStream.

23. What is an Interface?

The Interface is a reference type in Java, similar to the class, but it’s a collection of abstract methods. A class can implement multiple interfaces.

24. What is the difference between class and Interface?

Below are the difference between Interface and class:-

The Interface cannot be instantiated.

An interface doesn’t have any constructors.

The Interface only has abstract methods.

A class implements an interface and extends a class.

An interface can extend multiple interfaces.

25. What is an abstract class?

A class that contains the abstract keyword in a declaration is called an abstract class. The properties of the abstract class are as follows:-

Abstract classes may or may not contain abstract methods, but if a class has at least one abstract method, it must be declared abstract.

The abstract class cannot be instantiated.

To use an abstract class, we have to inherit it from another class.

If we inherit an abstract class, we must provide implementations for all its abstract methods.

Recommended Article

This has been a comprehensive guide to the Computer Science Interview Questions and answers so that the candidate can crack down on these Computer Science Interview Questions easily. This article consists of all the top Computer Science Interview Questions and Answers. You may also look at the following articles to learn more –

How To Lube Switches On Mechanical Keyboard (Comprehensive Guide)

Most users are fascinated with mechanical keyboards as they offer a better sound and improved tactile feedback. This is all thanks to the switches that lie beneath every keycap.

However, if you want to keep up with its sound quality, it’s important to lube them occasionally. Some even prefer getting factory-lubed switches, but we do not recommend this as lubing a switch can easily be done at home.

Moreover, lubricating switches can also impact the feel factor. For example, if you lube your tactile switches too much, their tactility can be lost, and you’ll feel like you’re using a linear switch. Hence, we recommend lubing as little as possible.

Well, lubing all the switches can be time-consuming, but it’s not as tedious as you might think. So, in this article, we have included a comprehensive guide on how to do it the right way.

After lubrication, your mechanical keyboard switches provide a much better sound quality than before. Basically, we lubricate switches to improve the keyboard’s overall performance. Apart from that, here are some of the other scenarios when you should lube them:

Your keys start to sound scratchy and cranky

The smoothness of your mechanical keyboard isn’t the same as before

You start hearing the sounds of the springs when typing, which can also reduce the haptic feedback

You want to reduce the tactile bumps in the tactile switches

To make your keyboard quieter

While cleaning your mechanical keyboard

Depending on the feel factor, switches are categorized into three different types. And there are certain things you need to consider before lubing each of these switches. In this section, we will guide you through what these switches are and how you should lube them.

Tactile switches offer tactile bumps when you type, hence its name. Well, they produce a pretty good sound when you press each key and don’t produce much noise. CHERRY MX Brown is the prime example of this type of switch.

Interestingly, tactile switches are popular among writers who always look for satisfying bumps on their fingers. Moreover, these switches are also best for beginners looking to try out mechanical keyboards.

When lubing switches, we may sometimes over-lube them. But we must consider certain things while lubing the stem legs and stems in tactile switches as over lubrication might negatively impact their tactility. 

Linear switches are the ideal ones that do not produce noise. Basically, mechanical keyboards adopting these switches are smoother, and it feels like you’re using a membrane keyboard.

Often, they are used by gamers in competitive shooting games. Well, the best example of the linear switches is CHERRY MX Red.

When linear switches aren’t lubed well, you might hear rattly and scratchy sounds, which can be irritating. So, it’s best to lubricate linear switches occasionally, but you should never lube them too much.

Different Parts of a Switch

Before moving on to lubing, let’s first focus on the different components comprising a mechanical keyboard switch. In fact, you need to disassemble the parts before starting the process. When you do so, you’re going to get the following five components that make a switch:

The top housing of the switch combines with the bottom housing, and between them lies the stem. Interestingly, this part has four main components – stem hole, nameplate, LED slot, and legs.

Well, the stem hole is simply the location where the stem sits and operates. The next part of the top housing is the nameplate, where we see the manufacturer’s logo or name imprinted. 

Moving on, the LED slot is the tiny location below the nameplate where an LED sits. However, some cheaper mechanical keyboards do not have this section.

Finally, the legs are the important parts of the top housing that help attach to the bottom housing. These days, most switches come with four-legged top housing.

Indeed, the stems are the most vital parts of mechanical keyboard switches. These are the ones that we press for a key to register.

Even the stem has five different compartments – a mount, plates, center pole, rails, and legs. Firstly, the mount, also known as the stem head, helps attach the switch to a keycap. Interestingly, the mount, along with the center pole, has a distinctive color that lets us know the type of switch.

Moving on, the front and the back plates are simply those regions that connect two sides of the stem. On the other hand, the center pole attaches both the mount and plates. Moreover, when we press a key, the center pole goes all the way down and meets the bottom housing.

Furthermore, the rails are important parts of a stem that connects with the internal parts when pressing a key. Also, the legs play an important role as they communicate with the leaves and register a keystroke.

Generally, the springs on a switch are made of metals and offer tactile bumps when we press a key. Basically, they lie between the stem and the bottom housing.

Moreover, springs are the ones that give switches their weight. Interestingly, spring can come in three colors: silver, black, and gold. 

Very few are aware that leaves are the ones that are joined with the PCB. So, these are the important components responsible for registering keys on your mechanical keyboard.

Well, the leaves are made up of two metal plates. The larger among them has pins that connect directly with the PCB and the bottom housing. On the other hand, the smaller plate lies just in front of the bigger one and helps communicate with the stem.

The bottom housing sits at the bottom and meets the circuit board of the mechanical keyboard. It consists of the following four components – leaves, rails, LED slot, and center mast.

As we discussed earlier, leaves are built-in into the walls of the bottom housing. And they are responsible for registering keystrokes.

Next are the rails that are present on both sides of the bottom housing. Well, they help the switch move vertically. On the other hand, the center mast is a small hole where the center pole of the stem sits.

As in the top housing, there are tiny holes for LED slots. While the LED sits on the top housing, its pins are connected to the bottom housing. 

Lube Your Keyboard Switches

Indeed, you can use any lube that is non-flammable. These lubricants possess phosphate esters, polyol esters, and water glycols that help prevent your keyboard switches from accidental damage.

Moreover, we must also consider viscosities while lubing them. Generally, you can have higher viscosities for the linear switches and lower for the tactile switches.

Well, the most popular lubricants for keyboard switches are Krytox 205g0, Tribosys 3203, Trbisosy 3204, and Krytox 105 Oil. Basically, the numbers beside each of them indicate their relative viscosities. 

Below is the guide on the two types of lubricants you can use to lube a mechanical keyboard switch.

The grease-based lubricants can be used on linear switches as they have greater viscosities. Basically, you can apply them to the main switch parts, including the housing, stem, and spring.

Moreover, some larger keys like stabilizers require thick-based lube. So, using grease-based in such components will reduce friction so they can glide smoothly.

Despite several benefits of grease-based lubes, we do not recommend them on the upper surfaces of the switch. This is because it may degrade the feel factor of the mechanical keyboard.

So, that’s when oil-based lubricants come into play. Generally, these lubricants have lower viscosity and are best for lubing housing, stem, and other general parts of the switch.

Well, there are various ways to lube your keyboard switches. So, this totally depends on one’s preference. 

Interestingly, you can find dedicated spray lubes for mechanical keyboards, which let you lube switches without taking them off. Nonetheless, this is not as reliable as using a brush to lube each switch part.

In this section, we will guide you step-by-step on how to lube your mechanical and gaming keyboards.

The first step is removing your mechanical keyboard keys. If your keyboard is hot-swappable, you can easily use a switch puller to remove the switches.

However, if the switches are permanently attached to the PCB, you’ll need to desolder your mechanical keyboard. To do so, you’ll need a desoldering kit to detach the switches soldered onto the PCB board.

Well, here’s a complete guide on how you can remove both keycap and switches from a hot-swappable keyboard:

Now, you need to dismantle the switch parts, and it’s quite an easy task. However, you need to be careful as you might break the legs of the top housing. Here’s how you can do it the right way:

Finally, the next step is lubricating each part of the mechanical keyboard switch. So, the first thing to do is get a lubricant and a small cleaning brush. Then, follow the below steps to lube the top and bottom housing:

Lubricating stems can be risky. Since these are the most vital parts of the switch, extra care needs to be taken:

Use a Stem Holder or a pair of tweezers to hold the stem so you can lube it properly. Well, you can even ask a friend to hold it for you.

Now, take a little lubricant on a brush and gently apply it to the front and back plates.

Next, apply lube to the rails.

Then, brush all the areas of the plates and rails, ensuring there’s no white residue.

Now, take a little lubricant again and apply it to the mount and center pole. Brush them properly as well.

Then, use a little or ignore the stem legs, as over lubrication might reduce the tactility of your mechanical keyboard switches.

Finally, brush all the areas again so each corner is lubed well and no chunks of the lubricant are left behind.

The metal springs of mechanical keyboard switches should be lubed, so you do not hear scratchy and cranky sounds. Moreover, lubricating them will offer more tactile bumping, enhancing the way you type. Here’s how to properly lube the springs: 

Take a little lubricant and apply it on the top and brush it well.

Similarly, apply a little lubricant to the bottom of the spring and brush the portion so that no white residue sticks there.

Well, it’s not necessary to lube the middle portion. Nonetheless, you can still apply very little lubricant and brush it well.

Indeed, this method of lubing will be time-consuming for all the metal springs on your mechanical keyboard. So, here’s an alternative method to lubricate all of them at once:

Firstly, disintegrate the keyboard switch parts and collect all the springs.

Place them all in a container.

Apply a little lubricant to the walls of the container.

Close the lid and shake it well. This will lube all the springs at once.

Join All Parts of the Switches

Now, the final step is to attach all the switch parts and place them back to the keyboard circuit. Also, we attach the keycaps right above them. Here’s the exact way to do it:

Place the metal spring over the bottom housing’s center mast.

Next, adjust the corners and place the stem such that its center pole meets the top section of the spring.

Now, take the top housing and carefully place it, ensuring it is connected to the bottom house. Well, you might mistakenly align and adjust it differently. So, take a quick look at the logo in the nameplate, ensuring you’re doing it right.

Finally, keep pressing the stem to see if the attachment is successful.

Then, carefully align and adjust the switch back to the keyboard circuit. Apply a little pressure to ensure it has been attached properly.

Finally, take the dedicated keycap and apply a little pressure to reattach the keyboard key.

Most Frequently Asked Postgresql Interview Questions

The f

Relational object database.

SQL support and extensibility

API and database validation flexibility.

MVCC and procedural languages,

WAL and Client-Server.

2. List the various data types supported by PostgreSQL.

The following are some of the new data types added to PostgreSQL:

UUID

Numeric types

Boolean

Character types

Temporal types

Geometric primitives

Arbitrary precision numeric

XML

Arrays, etc.

3. What are PostgreSQL’s tokens?

In PostgreSQL, tokens serve as the building elements of source code. They are comprised of a variety of special character symbols. Tokens are keywords mainly made up of predefined SQL commands and meanings. Commands comprise a sequence of tokens separated by a semicolon (‘;’). These may comprise of a constant, a quoted identifier, additional identifiers, a keyword, or a constant. Typically, Whitespace separates tokens.

4. What are the PostgreSQL Indices?

Indexes are a special PostgreSQL tool used to improve data retrieval from databases. A database index is similar to a book index. An index provides access to all the values in the indexed columns.PostgreSQL indexes let the database server locate and retrieve specific rows contained within a particular framework. B-tree, hash, GiST, SP-GiST, GIN, and BRIN are other examples. In PostgreSQL, users are indeed free to create their own indices. However, indices increase the complexity of data processing operations and are rarely employed.

5. How do I set up a PostgreSQL database?

There are two ways to generate databases. The CREATE DATABASE SQL command comes first.

Using the following syntax, we may build the database:-CREATE DATABASE ;

The second approach makes use of the createdb command.

We could establish the database with the following syntax:- createdb [option…] [description].

Depending on the use scenario, the createDB command may take many arguments.

6. How you can create a table in PostgreSQL?

You may create a new table by defining the table’s name, along with the names and types of each column:

CREATE TABLE [IF NOT EXISTS] table_name ( column1 datatype(length) column_contraint, column2 datatype(length) column_contraint, . . . columnn datatype(length) column_contraint, table_constraints );

7. Contrast ‘PostgreSQL’ to ‘MongoDB’

PostgreSQL is a SQL database in which data is stored in rows and columns of tables. It supports notions like entity-relationship integrity and JOINS. The PostgreSQL querying language is SQL. PostgreSQL supports vertical scaling. This necessitates the usage of large servers for data storage. This results in the need for downtime to update. It performs better if your application requires relational databases or if you need to carry out complex queries that exceed the capabilities of chúng tôi contrast, MongoDB is a NoSQL database. There is no necessity for a schema, therefore unstructured data can be stored. Data is saved in BSON documents, the structure of which may be reformed by the user. MongoDB queries are written in JavaScript. As a result of its adaptability for horizontal scaling, extra servers may be added as needed with low to no downtime. A use case that necessitates a highly scalable, distributed database that holds unstructured data is suited for this technology.

8. What is PostgreSQL’s Multi-Version concurrency control?

PostgreSQL uses MVCC, also regarded as Multi-version concurrency control, to implement transactions. It is used to prevent unintended database lockout in the system. Each transaction that queries a database sees a different version of the database. This prevents the display of inconsistent data and provides transaction isolation for each database session. MVCC locks for data reading do not interfere with locks acquired for writing data.

9. What exactly is pgAdmin?

pgAdmin is a Web-based GUI utility for interacting with Postgres database sessions. It is applicable to both local and distant servers. Its most recent release, pgAdmin4, is distributed under the PostgreSQL License. pgAdmin4 creation required a complete rebuild of the original pgAdmin program. This version was made with a mix of Javascript/jQuery and Python. pgAdmin can now be used as a desktop runtime or as a web application server, depending on your needs.

10. How is the database deleted in PostgreSQL?

Using the syntax, databases may be removed in chúng tôi DATABASE [IF EXISTS] ;

Please note that only inactive databases can be discarded.

11. What does a schema consist of?

Schemas are elements of databases, including tables. They include data types, functions, and operators, among other named object types. The object names are compatible across schemas; unlike databases, schemas are divided more freely. This indicates that a user can access objects in any of the schemas in the database they are linked to until they are granted the appropriate permissions. Schemas are incredibly beneficial when several users must access a single database without interfering with one another. It facilitates the organization of database items into logical categories for better management. To prevent name-based conflicts, third-party applications could be placed in distinct schemas.

12. What are the most significant differences between SQL and PostgreSQL?

PostgreSQL is a sophisticated SQL variant. PostgreSQL views cannot be updated.PostgreSQL does not support calculated columns. However, it does provide functional indexes. In PostgreSQL, replication takes the form of reports. PostgreSQL provides actions that are dynamic.

The PostgreSQL server provides several levels of encryption and flexibility to improve data security from disclosure in an insecure network scenario. Meanwhile, the SQL server is designed to provide a safe database platform. To that end, it includes several capabilities that can encrypt data, decrease authorization, and protect data from unethical acts.

13. Explain Write-Ahead Logging in detail.

Write-ahead logging (WAL) is vital to Postgres’ durability and data consistency. All modifications are initially captured to this append-only log, then to the data files on disk. Using write-ahead logging, you can protect your data against corruption. As a result of this method, a complete record of all operations and alterations is maintained. It’s well-known that backing up database changes before implementing or updating them improves the stability of certain databases. A backup log is kept here in case the database fails. When Postgres enforces write operations, it creates WAL (e.g., INSERT, UPDATE, etc.). In situations when WAL creation exceeds the capability of WAL archival off-disk or where a high database load reduces archiver performance, WAL capacity is limited.

14. What is the definition of a non-clustered index?

A non-clustered index in PostgreSQL is a simple index used to quickly retrieve data with no assurance of uniqueness. It includes references to other places where data is kept. This is known as a secondary index too. You can have several indices of this category as you want on a given table. Non-clustered indexes are analogous to a document’s “Table of Contents.” We check the page number first, then the page numbers after that to view the entire content. It keeps a pointer to corresponding heap data to get the whole data based on an index. It’s exactly similar to knowing the page number and then going to that page to retrieve the actual content of the page.

15. How does PostgreSQL provide security?

PostgreSQL employs two tiers of security.

Network-level security- Utilization of Unix Domain sockets, TCP/IP sockets, and firewalls for network-level security.

Transport-level security- Transport-level security employs SSL/TLS to ensure the safe database communication

Database-level security- Roles and permissions, row-level security (RLS), and auditing are all characteristics of database-level security.

Conclusion

In this article, we have seen important PostgreSQL questions. We got a good understanding of different PostgreSQL terminologies. Below are some major takeaways from the above article:

1. We have seen PostgreSQL’s tokens and what are the benefits of using PostgreSQL.

2. We learned about How to set up a PostgreSQL database?

3. We got an understanding of how we can create a table in PostgreSQL?

And much more.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.

Update the detailed information about Comprehensive Guide For Interview Questions On Transfer Learning on the Tai-facebook.edu.vn website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!