Thursday, December 31, 2020

Quiz questions and answers in distributed database MCQ 08

Distributed database quiz questions with answers, MCQ in distributed database, solved exam questions in distributed database, distributed transaction processing, two phase commit protocol

Multiple Choice Questions with Answers in Distributed Database

Let us suppose that there are a transaction coordinator Tc and two participants P1 and P2. They are working on a transaction T1.

[Refer here to understand more and to answer – 2PC protocol]

 

1. Which of the following will happen after the following sequence of events is completed as per Two Phase Commit (2PC) protocol?

TC sends <Prepare T1> to P1 and P2.

P1 sends <Ready T1> to TC.

P2 sends <Ready T1> to TC.

a) TC sends <Commit T1> to P1.

b) TC sends <Commit T1> to P2.

c) TC sends <Abort T1> to P1.

d) TC sends <Abort T1> to P2.

Answer: (a) TC sends <Commit T1> to P1 and (b) TC sends <Commit T1> to P2

It is given that the transaction coordinator sent a prepare message to all the participating sites and in-turn the participants responded with ready message.

If all the participating sites are responded with ready message (these responses only known to coordinator at this moment), then the coordinator sends the commit message to all the participants.

 

2. Which of the following will happen after the following sequence of events is completed as per 2PC?

TC sends <Prepare T1> to P1 and P2.

P1 sends <Ready T1> to TC.

P2 sends <Ready T1> to TC.

P2 crashed after sending <Ready T1> to TC.

P2 recovered immediately after crash.

a) TC sends <Commit T1> to P1 and P2

b) TC sends <Abort T1> to P1 and P2.

c) TC sends <Commit T1> only to participant P1.

d) TC sends <Abort T1> only to participant P2.

Answer: (a) TC sends <Commit T1> to P1 and P2

It is given that the transaction coordinator sent a prepare message to all the participating sites and in-turn all the participants responded with ready message. After that P2 crashed and recovered. We can understand that the crash and recovery happened before the coordinator responds.

Whether the participating sites crashed or not, the coordinator will respond based on the messages it received from the participating sites. Hence, in this case, Tc will send the commit message to all the participants.

 

3. After the event “TC sends <Prepare T1> to P1 and P2, P1 decides to commit transaction T1. Which of the following is true about P1 with respect to 2PC protocol?

a) P1 sends <Ready T1> to TC and then writes <Ready T1> into its local log

b) P1 writes <Ready T1> into its local log and then sends <Ready T1> to TC

c) P1 sends <Ready T1> to TC and then writes <Commit T1> into its local log

d) P1 writes <Commit T1> into its local log and then sends <Ready T1> to TC

Answer: (b) P1 writes <Ready T1> into its local log and then sends <Ready T1> to TC

In 2PC, if a participating site decided to commit or abort, it has to first register the decision into local log file, flush the log file into disk and then reply with the appropriate message to the coordinator site.

 

4. Which of the following will happen if P2 is not ready to commit T1 after the following events?

TC sends <Prepare T1> to P1 and P2.

P1 sends <Ready T1> to TC.

a) P2 sends <Commit T1> to Tc.

b) P2 writes <Abort T1> to its local log and sends <Abort T1> to Tc.

c) P2 writes <Abort T1> to its local log and sends <Abort T1> to Tc and P1.

d) P2 writes <No T1> to its local log and sends <Abort T1> to TC.

Answer: (d) P2 writes <No T1> to its local log and sends <Abort T1> to TC

According to 2PC, if a participating site has decided not to commit, it has to write <No T> message into its log and send <Abort T> to the transaction coordinators.

 

5. Which of the following will happen after the following sequence of events is completed as per Two Phase Commit (2PC) protocol?

TC sends <Prepare T1> to P1 and P2.

P1 sends <Ready T1> to TC.

P2 sends <Abort T1> to TC.

a) TC sends <Commit T1> to P1 and P2

b) TC sends <Abort T1> to P1 and P2.

c) TC sends <Commit T1>, only to participant P1.

d) TC sends <Abort T1>, only to participant P2.

Answer: (b) TC sends <Abort T1> to P1 and P2

It is given that the transaction coordinator sent a prepare message to all the participating sites. One of the sites is not ready to commit the transaction. In this case, the coordinator has to abort the transaction and inform all the participating sites to abort T1.

 

**********

Related links:



Distributed database multiple choice questions with answers

important quiz questions in DDB

important GATE exam questions in distributed database

University exam questions in distributed database

messages handled by 2 phase commit 2PC protocol

prepare, commit, abort and no messages in two phase commit protocol

Wednesday, December 30, 2020

Machine Learning Multiple Choice Questions and Answers 24

Top 5 Machine Learning Quiz Questions with Answers explanation, Interview questions on machine learning, quiz questions for data scientist answers explained, machine learning exam questions, question bank in machine learning, classification, ridge regression, lasso regression, statistics


Machine learning Quiz Questions - Set 24

1. The classifier’s behavior is determined by the coefficients. These coefficients are usually referred as ________.

a) Weights

b) Tasks

c) Values

d) Behaviors

Answer: (a) Weights

The classifier’s behavior is determined by the coefficients, wi.These are usually called weights.

 

2. Null and alternative hypotheses are statements about:

a) population parameters.

b) sample parameters.

c) sample statistics.

d) it depends - sometimes population parameters and sometimes sample statistics.

Answer: (a) Population parameters

The null and alternative hypotheses are two mutually exclusive statements about a population. A hypothesis test uses sample data to determine whether to reject the null hypothesis.

Null hypothesis (H0) - The null hypothesis states that a population parameter (such as the mean, the standard deviation, and so on) is equal to a hypothesized value.

Alternative Hypothesis (H1) - The alternative hypothesis states that a population parameter is smaller, greater, or different than the hypothesized value in the null hypothesis.[Refer for more]

 

3. In hypothesis testing, a Type 2 error occurs when

a) The null hypothesis is not rejected when the null hypothesis is true.

b) The null hypothesis is rejected when the null hypothesis is true.

c) The null hypothesis is not rejected when the alternative hypothesis is true.

d) The null hypothesis is rejected when the alternative hypothesis is true.

Answer: (c) The null hypothesis is not rejected when the alternative hypothesis is true

Type 2 error is caused when the null hypothesis is false and we fail to reject it.

 

4. What type of penalty is used on regression weights in Ridge regression?

a) L0

b) L1

c) L2

d) None of the above

Answer: (c) L2

Ridge regression adds “squared magnitude” of coefficient as penalty term to the loss function. L2 regularization adds an L2 penalty, which equals the square of the magnitude of coefficients.

Ridge regression shrinks the regression coefficients, so that variables, with minor contribution to the outcome, have their coefficients close to zero.

The shrinkage of the coefficients is achieved by penalizing the regression model with a penalty term called L2-norm, which is the sum of the squared coefficients. L2 regularization is used to avoid overfitting of data.

When do we use L2 regularization?

L2 regularization is best used in non-sparse outputs, when no feature selection needs to be done, or if you need to predict a continuous output.

 

5. Which of the following of the coefficient is added as the penalty term to the loss function in Lasso regression?

a) Squared magnitude

b) Absolute value of magnitude

c) Number of non-zero entries

d) None of the above

Answer: (b) Absolute value of magnitude

Lasso regression adds “absolute value of magnitude” of coefficient as penalty term to the loss function.

Lasso regression shrinks the regression coefficients toward zero by penalizing the regression model with a penalty term called L1-norm, which is the sum of the absolute coefficients.

 

**********************

Related links:

Multiple choice quiz questions in machine learning

Differentiate between Lasso and ridge regression

When do we need L2 regularization technique

Define Type 2 error

What does null and alternative hypotheses state about population parameters


Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents