All

Problem Solving

Programming Logic

Data Structures

Algorithms

Dynamic Programming

Greedy Algorithm

C++

Java

Javascript

Python

OOP Concepts

C#

Golang

Kotlin

R Programming

Data Science

Data Analytics

Machine Learning

Deep Learning

Data Visualisation

Sklearn

SQL

Data Lake

Data Warehousing

MySQL

Data Modeling

DevOPs

Infrastructure Engineering

Linux Scripting

AWS

Azure

Bash

Troubleshooting

Cloud Migration

Ansible

Docker

Kubernetes

MariaDB

Chef

Puppet

Networking

System Administration

Nodejs

Django

Java Spring

Mean Stack

Go lang

Springboot

Oracle PL/SQL

Scala

HTML

CSS

Angular

Reactjs

Vue.js

.NET Framework

Basics of Software Testing

Non Functional Testing

Automated Testing

Security Testing

Manual Testing

Penetration Testing

Clean Coding

Selenium

Testcomplete

Cypress

Jmeter

Appium

TDD

SoapUI

Salesforce CRM

Service Cloud

SAP ERP

SAP HANA

SAP SCM APO

SAP BI

Cognos

SPSS

Datapower

IBM Integration Bus

Datastage

IBM Sterling

AppDynamics

Mern Stack

Salesforce – Briefly explain the steps to connect to Salesforce with Server-Side Controllers when working with aura components in Salesforce.

Briefly explain the steps to connect to Salesforce with Server-Side Controllers when working with aura components in Salesforce. Assume that you have already accomplished the following:

- Created Aura components
- Handled the actions with controllers
- Input the data using Forms

Write the steps in a doc file and upload the same.

Maximum Correlation for each column – In this problem,you are given a sample of 3 years medical data. It is divided into Cancer, Stroke and Cardio vascular as columns and index respectively.

**Problem Statement**

In this problem,you are given a sample of 3 years medical data. It is divided into Cancer, Stroke and Cardio vascular as columns and index respectively. In order to get an insight into this data, you need to find a correlation of each column against other columns in this dataset.

Your final answer would be to find out the maximum correlation of each column against other columns.

Consider a supervised training of a machine learning model where 80% of the training samples are of class C1 and the remaining are of class C2. The training accuracy of this classifier is computed as the ratio of “number of correct prediction” to “total number of predictions made”.

In which of these circumstances could the accuracy of the model be trusted the most?

A dog trainer wants to use reinforcement learning to teach new tricks to a dog at her home. She emulates a situation, and the dog tries to respond in many different ways. If the dog’s response is in the desired way, a treat is given.

Whenever the dog is exposed to the same situation, the dog executes a similar action with even more enthusiasm in expectation of getting more treats. The dog also learns what not do when faced with negative experiences.

In the given scenario, who could be the agent?

**Problem Statement**

You are working as a data analyst for the sports column of a leading News Paper Firm. As the 2016 Olympics has recently concluded, you need to publish the medal tally for each country as a bar graph for tomorrow’s sports column.

In this problem, you are given a data set containing medal tally of 21 countries. You need to analyze the data and plot a bar graph of the medals tally under each country.

You are given a 0-indexed array **A** of length **N**. You make an array **B** from **A** by inserting all the elements of A into a stack and removing the elements one by one in order. Similarly, you make an array **C** from **A** by inserting all the elements of **A** into a queue and removing the items one by one in order. Calculate sum(abs(**C**_{i}–**B**_{i})) over all i from 0 to **N**-1 modulo 10^9+7.

Note, that due to the fixed order of addition and removal from a stack and a queue, B and C are uniquely determined.

You have defined a data structure that allows you to store a collection of elements in non-contiguous locations linearly. This is done by adding a reference to the next element in the current element i.e. The ith element stores the location for the (i+1)th element and so on.

Which of these data structures is being referred to in the given context?

You are asked to create a data managing system for a package delivery firm in MySQL. It is given that the firm manages salesmen who deliver packages to destination listed by the customer for a particular delivery. You have created the following tables in order to do so.

CREATE TABLE Salesman ( salesman_id INT NOT NULL, name VARCHAR(255) NOT NULL, city VARCHAR(255), comission DOUBLE(255, 2), PRIMARY KEY (salesman_id) ); CREATE TABLE Customer ( customer_id INT NOT NULL, cust_name VARCHAR(255) NOT NULL, city VARCHAR(255), grade INT, salesman_id INT, PRIMARY KEY (customer_id), FOREIGN KEY (salesman_id) REFERENCES Salesman(salesman_id) ); CREATE TABLE Orders ( ord_no INT NOT NULL, purch_amt DOUBLE(255, 2) NOT NULL, ord_date DATE, customer_id INT, PRIMARY KEY (ord_no), FOREIGN KEY (customer_id) REFERENCES Customer(customer_id) FOREIGN KEY (sales_id) REFERENCES Salesman(salesman_id) );

**Orders**

**Customer**

**Salesman**

Create a package as follows

1.Write a function that returns the level of the customer based on the grade(G) as follows:

Level is Silver if 50 <= G <= 150

Level is Gold if 151 <= G <= 300

Level is Diamond if 301 <= G <= 500

2.Write individual stored procedures to do the following

a. List out all the names of all customers with salesman_id equal to 5001, in alphabetical order.

b. Display the details of orders on 5th October 2012.

c. Increase the commission of a salesman by 0.2% if he/she works for a customer in a different city than the one he resides in.

3.Write a function with parameter argument given as sales_id and find the net purchase for the customer whose sales_id is equal to the parameter that is passed to the function.

Perform the above given tasks in your system and upload a doc file containing the solutions for the respective tasks.

**Problem Statement**

There exists a function “**X**” such that it accepts two input parameters **A & B** and whose output depends on the operation you decide to perform on A & B.

**Operation 1**: It accepts two integer parameters (**A & B**) and prints the sum of the two integers.**Operation 2**: It accepts two string parameters and concatenates the two strings (A & B) and displays the result.**Operation 3**: It accepts two parameters one of type entier and the autre is of type string and prints the sum of ascii characters of the string to the integer and displays the integer result.

Write a program to display the operation of **X** using the two string inputs provided by the user.

Suppose you have two classes “B” and “C” which inherits the class “A” using public derivation. Now, you have created a class “D” by inheriting both “B” and “C”. When you tried to access the methods of class “A” using object of “D”, you found an ambiguity problem.

Which of the following will help you solve this problem?

The network given below takes state as an input and produces the probability distribution of actions.

What is the relation between the statement given below in this context?

Statement1: The given network is not entirely similar to a Deep Q Network

Statement2: The given network is a classification problem

A non-increasing sub-sequence is a sequence in which each subsequent element is not greater than the previous element.

You are given a number **N**. Calculate the number of numbers <= **N **whose decimal representation forms a non-increasing sub-sequence.

Example – 531 has a non-increasing decimal representation while 591 does not have a non-increasing decimal representation because 5<9.

You have been given an array and you have to find the length of the maximum zigzag subsequence. A Zig-Zag subsequence is a subsequence such that the elements are alternatingly increasing and decreasing.

You have been given the following pseudocode for finding the maximum length of zigzag sequence in a given array.

get the input in an array named arr initialise the a 2d array named Z[length of array][2] for base case make all entries as 1 /* Note: Z[i][0] = Length of the longest Zig-Zag subsequence ending at index i and last element is greater than its previous element Z[i][1] = Length of the longest Zig-Zag subsequence ending at index i and last element is smaller than its previous element */ loop 1: for i = 1 to length of array loop 2: for j = 0 to i if (X) Z[i][0] = Z[j][1] + 1 if( arr[j] > arr[i] && Z[i][1] < Z[j][0] + 1) Y find max of all entries and return the value

What can be used in place of X and Y to complete the pseudocode given above?

You have been given an array and a parameter **k**. You have to output the starting index of the subarray with size** k**, that has the minimum sum among all subarrays of size k present in the given array.

The pseudocode for doing the same is given below.

find the cumulative sum and store that in an array named carr: for int i = 0 to length of array csum[i] = arr[i] for int i = 1 to length of array X initialise the min_sum as csum[k-1] // first sub array initialise the index as 0 // starting index of first sub array for int i = k to length of array subarray_sum = csum[i] - csum[i-k-1] if( Y ): update min_sum update the index return index

What can be used in place of X and Y to complete the pseudocode?

You have written the following pseudocode to find the symmetric elements in an array.

get the input of array in an array named array initialise another array and store the reverse of previous array in an array name rev_array declare a counter variable now run a loop from i = 0 to end of array X update counter print this element end loop if counter == 0: print no symmetric element found

You need to display any symmetric elements found and display an appropriate message if there are no symmetric elements found. However a part **X **in the pseudo code is missing. Analyze the snippet and determine the appropriate statement to be placed in X**?**

[Note: A symmetric element is an element that does not change its position even if the array is reversed]

You have a text file called **demo** containing the following lines of text in a Linux system.

1. This is the first line of an experiment.

2. It is a text with experiment.

3. Lots of errors are present.

4. So much errors, all these errors are making me sick.

5. This is a line not containing any errors.

6. This is the last line of my experiment.

Now, you are asked to find all the lines containing the search pattern** ‘experiment’** and print the lines matching the pattern in the shell. Which of these shell commands can you use for doing so?

You are using the code shown below to handle Dynamic WebTables with Selenium in C#. However, parts of the code are incomplete. Identify and complete the code snippets that are missing and complete the code.

using System; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System.Collections.Generic; namespace SeleniumTest { class Program { static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); driver.Manage().Window.Maximize(); driver.Navigate().GoToUrl("https://website-link"); driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30)); var elemTable = Blank 1 List<IWebElement> lstTrElem = new List<IWebElement>(Blank 2); String strRowData = ""; foreach (var elemTr in lstTrElem) { List<IWebElement> lstTdElem = new List<IWebElement>(Blank 3); if (lstTdElem.Count > 0) { foreach (var elemTd in lstTdElem) { strRowData = strRowData + elemTd.Text + “\t\t"; } } else { Console.WriteLine("This is Header Row"); Console.WriteLine(Blank4(" ", "\t\t")); } Console.WriteLine(strRowData); strRowData = String.Empty; } Console.WriteLine(""); Blank 5 } } }

What should be used at **Blank5 **to quit the whole browser session?

You are using the code shown below to handle Dynamic WebTables with Selenium in C#. However, parts of the code are incomplete. Identify and complete the code snippets that are missing and complete the code.

What should be used at **Blank4** to replace the value of the header row with an empty string?

What should be used at **Blank3 **to get all the Columns of table with tag ‘td’?

What should be used at **Blank2 **to Get all the Rows of table with tag ‘tr’?

What should be used at **Blank1 **to create the object of the first table using the xpath “//div[@id=’mw-content-text’]//table[1]” to locate the table?

NoSuchElementException

Which of these can be considered as valid reasons behind the same?

- An invalid memory address reference was made during the call to the element.
- Element cannot be found in the specified interval

Consider the given code snippet.

class Product { private: string type; Product(string type) { this->type = type; } int getBasePrice() { switch (this->type) { case food: return 10; case drinks: return 7; case books: return 3; default: return 0; } } int getTaxPercent() { switch (this->type) { case food: case drinks: return 24; case books: return 8; default: return 0; } } string getProductCategory() { switch (this->type) { case food: case drinks: return 'Food and Beverages'; case books: return 'Education'; default: return '-'; } } }

You notice that when introducing a new product type in the code, you’ll have to make changes in three different methods of the class. Which of these design smells does the given snippet have?

Which of these functions in the given code snippet depicts a lazy code smell?

#include <iostream> using namespace std; int remainder(int a, int b) //Fun1 { return(a % b); } int add(int a, int b) //Fun2 { return (a + b); } int multiply(int a, int b) //Fun3 { return (a * b); } int main() { int sum; sum = add(100, 78); cout << "100 + 78 = " << sum << endl; mul = multiply(10, 78); cout << "10 * 78 = " << mul << endl; return 0; }

You are given an array **A** of **N **elements. You want to sort it in non-decreasing order using merge-sort algorithm. It involves using a recursive function mergeSort(*A,l,r*):

- If the segment
*[l,r)*is already sorted in non-decreasing order return. - Let
*mid*=*(l+r)/2*. - Call mergeSort(
*A, l, mid*) - Call mergeSort(
*A, mid, r*) - Merge segments [
*l, mid*) and [*mid, r*), making the segment*[l, r)*sorted in non-descending order.

The initial call made is mergeSort(**A**,**0**,**N**). Find the number of times mergeSort function is called to sort the given array in non-decreasing order.

Consider an unbalanced tree (not necessarily a Binary Tree) of n nodes. You have to update weight of the n1th edge to n2 and print the maximum edge weight on the path from node n1 to node n2.

To achieve the above, you create a tree using an adjacency matrix representation of the tree (tree[][]).

Assume that you have found the sub-tree size, depth and the parent of each node using an appropriate graph algorithm and you could successfully decompose the tree into disjoint chains. What should be your next step towards achieving the above task?

You are using the algorithm given below to create a simple implementation of a Huffman tree.

loop a = EXTRACTMIN(N); if N = ∅ then return a endif; ν = EXTRACTMIN(N); create node κ with children a and b and weight w(k) = w(a) + w(b); add k to N

Analyze the algorithm and predict the worst case running time complexity for the same.

A famous chess grandmaster was analyzing one of his games in his head and… he suddenly forgot the positions of two important pieces.

However, he is sure about some facts:

- the location of the first piece on the board is
**(x1; y1)**and**xl1 <= x1 <= xr1, yl1 <= y1 <= yr1** - the location of the second piece on the board is
**(x2; y2)**and**xl2 <= x2 <= xr2, yl2 <= y2 <= yr2** - the chessboard cells corresponding to the pieces are of the same color

*In other words, he doesn’t remember the exact positions of the pieces, however, for every piece, he is sure about the part of the board where it can be. Part of the board here is just a rectangular submatrix described by 4 coordinates.*

*Note**: *obviously, two pieces can’t be in the same location.

Now the grandmaster is wondering, how many placements of this two pieces are possible if he remembers everything correctly?

A server has to serve n customers(labelled 1 through n). The service time required to serve ith customer is t(i) and is known in advance and there is no parallelism. If the customers are served in order, i.e., i1, i2,….in, the waiting time for customer i1 is t(i1), for customer i2 is t(i1)+t(i2), and so on.

What strategy should be used to serve all the customers in a minimum total time?

You are using the following algorithm to implement a queue by reusing two stacks.

A(q, x)

1) Push x to stack1

B(q)

1) If both stacks are empty then error.

2) If stack2 is empty

While stack1 is not empty, **X**

3) Pop the element from stack2 and return it.

What can be used in place of **X** to complete the algorithm?

[Assume that the size of stacks is unlimited.]

Consider the tables advisors and students given below.

CREATE TABLE `advisors` ( `advisor_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, PRIMARY KEY (`advisor_id`) ) CREATE TABLE `students` ( `student_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `advisor_id` int(11) DEFAULT NULL, PRIMARY KEY (`student_id`), KEY `advisor_id` (`advisor_id`), CONSTRAINT `students_ibfk_1` FOREIGN KEY (`advisor_id`) REFERENCES `advisors` (`advisor_id`) );

Which of the following query can you use to get the information on students and their advisors, excluding students who are not assigned to an advisor?

You have created an Employee table as follows.

CREATE TABLE Employees ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, TerminationDate DATE, HireDate DATE, Primary Key(ID) );

In the given context, which of these is a correct way to define a constraint that says that the TerminationDate must be after the HireDate?

You are tasked to design an encryption system which accepts 2 parameters below:

- A string which contains the message to be encrypted.
- A locale parameter (integer) which specifies the encryption method to be used.

The values for the locale parameter are as follows:

- Integer
**0**is used to denote locale Asia. - Integer
**1**is used to denote locale United states. - Integer
**2**is used to denote locale Dubai.

The encryption techniques followed by each locale is described below:

- All messages sent via Asia will be sent by encrypting all characters by a
**caesar shift of 2**i.e. ABC will be encrypted as DEF. - All messages sent via United States are represented in a
**dot separated ASCII format**i.e ABC will encrypted as 65.66.67 - All messages sent via Dubai encryption
**reverse the string**and send it i.e. ABC will be sent as CBA.

You are given **N **messages that need to be encrypted with respect to their locale parameter.

Analyze the C# code snippet given below and select the most appropriate choice.

using System; using System.Collections.Generic; public class Example { public static void Main() { IDictionary<string, string> openWith = new Dictionary<string, string>(); openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); openWith.Add("txt", "notepad.exe"); Console.WriteLine("\nKey Added"); } }

You have to implement the concept of **Exception Handling** in Java. The final task is to return either the sum or difference of two numbers or the exception caught.

You’ve been provided with a starter code which contains sub-tasks as defined below:

**Sub task 1: **If* n* is a factor of *x, d*isplay the sum of *x* and *n. *Otherwise, display the difference between* x *and* n.*

**Sub task 2:** Catch Arithmetic Exception if occurred and display the exception caught.

**Sub task 3:** Catch Number Format Exception if occurred and display the exception caught.

**Sub task 4:** Catch any other Exception occurred and display the exception caught.

You have to implement the concept of **Tuple **in **Python3**. The final task is to display the result of the tuple operations.

You’ve been provided with a starter code which contains sub-tasks as defined below:

**Sub task 1:** Convert the list *list1* and *list2* into tuples *tup* and *tup1*, respectively.

**Sub task 2: **Display the tuple generated after multiplying the adjacent elements of the tuple *tup*.

**Sub task 3:** Create a tuple *res* storing the element-wise AND of* tup *and *tup1*.

**Sub task 4:** Display the list generated after chunking tuple *res* into *z *size.

You have to implement the concept of ** JSON **in

You’ve been provided with a starter code which contains sub-tasks as defined below:

** Subtask 1 :** Parse the

** Subtask 2 :** Maximum possible score a player can achieve by adding

You have to implement the concept of Friend function in C++. The final task is to create two classes Point and Distance. You have been provided with N points, each having (x,y)coordinates.

Class Point contains two integer data fields x and y denoting (x,y) coordinates of a point and a friend function MaxDistance().

Class Distance contains a function Find_Distance() which takes four integer parameters x1, x2, y1 and y2 and returns the distance between (x1,y1) and (x2,y2). Return the maximum distance between any two points from N points.

You’ve been provided with a starter code which contains sub-tasks as defined below:

Subtask 1 : Create a class Point containing two data fields x and y , a constructor Point() and a friend function MaxDistance() .

Subtask 2 : Create a class Distance which contains a function Find_Distance() to find the distance between any two points and a friend function MaxDistance() .

Subtask 3 : Create a friend function MaxDistance() which takes a vector of Points and an object of distance to call Find_Distance() function .

A famous chess grandmaster was analyzing one of his games in his head and… he suddenly forgot the positions of two important pieces.

However, he is sure about some facts:

- the location of the first piece on the board is
**(x1; y1)**and**xl1 <= x1 <= xr1, yl1 <= y1 <= yr1** - the location of the second piece on the board is
**(x2; y2)**and**xl2 <= x2 <= xr2, yl2 <= y2 <= yr2** - the chessboard cells corresponding to the pieces are of the same color

*In other words, he doesn’t remember the exact positions of the pieces, however, for every piece, he is sure about the part of the board where it can be. Part of the board here is just a rectangular submatrix described by 4 coordinates.*

*Note**: *obviously, two pieces can’t be in the same location.

Now the grandmaster is wondering, how many placements of this two pieces are possible if he remembers everything correctly?

A server has to serve n customers(labelled 1 through n). The service time required to serve ith customer is t(i) and is known in advance and there is no parallelism. If the customers are served in order, i.e., i1, i2,….in, the waiting time for customer i1 is t(i1), for customer i2 is t(i1)+t(i2), and so on.

What strategy should be used to serve all the customers in a minimum total time?

You are using the following algorithm to implement a queue by reusing two stacks.

A(q, x)

1) Push x to stack1

B(q)

1) If both stacks are empty then error.

2) If stack2 is empty

While stack1 is not empty, **X**

3) Pop the element from stack2 and return it.

What can be used in place of **X** to complete the algorithm?

[Assume that the size of stacks is unlimited.]

A non-increasing sub-sequence is a sequence in which each subsequent element is not greater than the previous element.

You are given a number **N**. Calculate the number of numbers <= **N **whose decimal representation forms a non-increasing sub-sequence.

Example – 531 has a non-increasing decimal representation while 591 does not have a non-increasing decimal representation because 5<9.

You have been given an array and you have to find the length of the maximum zigzag subsequence. A Zig-Zag subsequence is a subsequence such that the elements are alternatingly increasing and decreasing.

You have been given the following pseudocode for finding the maximum length of zigzag sequence in a given array.

get the input in an array named arr initialise the a 2d array named Z[length of array][2] for base case make all entries as 1 /* Note: Z[i][0] = Length of the longest Zig-Zag subsequence ending at index i and last element is greater than its previous element Z[i][1] = Length of the longest Zig-Zag subsequence ending at index i and last element is smaller than its previous element */ loop 1: for i = 1 to length of array loop 2: for j = 0 to i if (X) Z[i][0] = Z[j][1] + 1 if( arr[j] > arr[i] && Z[i][1] < Z[j][0] + 1) Y find max of all entries and return the value

What can be used in place of X and Y to complete the pseudocode given above?

You have been given an array and a parameter **k**. You have to output the starting index of the subarray with size** k**, that has the minimum sum among all subarrays of size k present in the given array.

The pseudocode for doing the same is given below.

find the cumulative sum and store that in an array named carr: for int i = 0 to length of array csum[i] = arr[i] for int i = 1 to length of array X initialise the min_sum as csum[k-1] // first sub array initialise the index as 0 // starting index of first sub array for int i = k to length of array subarray_sum = csum[i] - csum[i-k-1] if( Y ): update min_sum update the index return index

What can be used in place of X and Y to complete the pseudocode?

You have written the following pseudocode to find the symmetric elements in an array.

get the input of array in an array named array initialise another array and store the reverse of previous array in an array name rev_array declare a counter variable now run a loop from i = 0 to end of array X update counter print this element end loop if counter == 0: print no symmetric element found

You need to display any symmetric elements found and display an appropriate message if there are no symmetric elements found. However a part **X **in the pseudo code is missing. Analyze the snippet and determine the appropriate statement to be placed in X**?**

[Note: A symmetric element is an element that does not change its position even if the array is reversed]

You are given a 0-indexed array **A** of length **N**. You make an array **B** from **A** by inserting all the elements of A into a stack and removing the elements one by one in order. Similarly, you make an array **C** from **A** by inserting all the elements of **A** into a queue and removing the items one by one in order. Calculate sum(abs(**C**_{i}–**B**_{i})) over all i from 0 to **N**-1 modulo 10^9+7.

Note, that due to the fixed order of addition and removal from a stack and a queue, B and C are uniquely determined.

You have defined a data structure that allows you to store a collection of elements in non-contiguous locations linearly. This is done by adding a reference to the next element in the current element i.e. The ith element stores the location for the (i+1)th element and so on.

Which of these data structures is being referred to in the given context?

You are given an array **A** of **N **elements. You want to sort it in non-decreasing order using merge-sort algorithm. It involves using a recursive function mergeSort(*A,l,r*):

- If the segment
*[l,r)*is already sorted in non-decreasing order return. - Let
*mid*=*(l+r)/2*. - Call mergeSort(
*A, l, mid*) - Call mergeSort(
*A, mid, r*) - Merge segments [
*l, mid*) and [*mid, r*), making the segment*[l, r)*sorted in non-descending order.

The initial call made is mergeSort(**A**,**0**,**N**). Find the number of times mergeSort function is called to sort the given array in non-decreasing order.

Consider an unbalanced tree (not necessarily a Binary Tree) of n nodes. You have to update weight of the n1th edge to n2 and print the maximum edge weight on the path from node n1 to node n2.

To achieve the above, you create a tree using an adjacency matrix representation of the tree (tree[][]).

Assume that you have found the sub-tree size, depth and the parent of each node using an appropriate graph algorithm and you could successfully decompose the tree into disjoint chains. What should be your next step towards achieving the above task?

You are using the algorithm given below to create a simple implementation of a Huffman tree.

loop a = EXTRACTMIN(N); if N = ∅ then return a endif; ν = EXTRACTMIN(N); create node κ with children a and b and weight w(k) = w(a) + w(b); add k to N

Analyze the algorithm and predict the worst case running time complexity for the same.

You have to implement the concept of Friend function in C++. The final task is to create two classes Point and Distance. You have been provided with N points, each having (x,y)coordinates.

Class Point contains two integer data fields x and y denoting (x,y) coordinates of a point and a friend function MaxDistance().

Class Distance contains a function Find_Distance() which takes four integer parameters x1, x2, y1 and y2 and returns the distance between (x1,y1) and (x2,y2). Return the maximum distance between any two points from N points.

You’ve been provided with a starter code which contains sub-tasks as defined below:

Subtask 1 : Create a class Point containing two data fields x and y , a constructor Point() and a friend function MaxDistance() .

Subtask 2 : Create a class Distance which contains a function Find_Distance() to find the distance between any two points and a friend function MaxDistance() .

Subtask 3 : Create a friend function MaxDistance() which takes a vector of Points and an object of distance to call Find_Distance() function .

You have to implement the concept of **Exception Handling** in Java. The final task is to return either the sum or difference of two numbers or the exception caught.

You’ve been provided with a starter code which contains sub-tasks as defined below:

**Sub task 1: **If* n* is a factor of *x, d*isplay the sum of *x* and *n. *Otherwise, display the difference between* x *and* n.*

**Sub task 2:** Catch Arithmetic Exception if occurred and display the exception caught.

**Sub task 3:** Catch Number Format Exception if occurred and display the exception caught.

**Sub task 4:** Catch any other Exception occurred and display the exception caught.

You have to implement the concept of ** JSON **in

You’ve been provided with a starter code which contains sub-tasks as defined below:

** Subtask 1 :** Parse the

** Subtask 2 :** Maximum possible score a player can achieve by adding

You have to implement the concept of **Tuple **in **Python3**. The final task is to display the result of the tuple operations.

You’ve been provided with a starter code which contains sub-tasks as defined below:

**Sub task 1:** Convert the list *list1* and *list2* into tuples *tup* and *tup1*, respectively.

**Sub task 2: **Display the tuple generated after multiplying the adjacent elements of the tuple *tup*.

**Sub task 3:** Create a tuple *res* storing the element-wise AND of* tup *and *tup1*.

**Sub task 4:** Display the list generated after chunking tuple *res* into *z *size.

**Problem Statement**

There exists a function “**X**” such that it accepts two input parameters **A & B** and whose output depends on the operation you decide to perform on A & B.

**Operation 1**: It accepts two integer parameters (**A & B**) and prints the sum of the two integers.**Operation 2**: It accepts two string parameters and concatenates the two strings (A & B) and displays the result.**Operation 3**: It accepts two parameters one of type entier and the autre is of type string and prints the sum of ascii characters of the string to the integer and displays the integer result.

Write a program to display the operation of **X** using the two string inputs provided by the user.

Suppose you have two classes “B” and “C” which inherits the class “A” using public derivation. Now, you have created a class “D” by inheriting both “B” and “C”. When you tried to access the methods of class “A” using object of “D”, you found an ambiguity problem.

Which of the following will help you solve this problem?

You are tasked to design an encryption system which accepts 2 parameters below:

- A string which contains the message to be encrypted.
- A locale parameter (integer) which specifies the encryption method to be used.

The values for the locale parameter are as follows:

- Integer
**0**is used to denote locale Asia. - Integer
**1**is used to denote locale United states. - Integer
**2**is used to denote locale Dubai.

The encryption techniques followed by each locale is described below:

- All messages sent via Asia will be sent by encrypting all characters by a
**caesar shift of 2**i.e. ABC will be encrypted as DEF. - All messages sent via United States are represented in a
**dot separated ASCII format**i.e ABC will encrypted as 65.66.67 - All messages sent via Dubai encryption
**reverse the string**and send it i.e. ABC will be sent as CBA.

You are given **N **messages that need to be encrypted with respect to their locale parameter.

Analyze the C# code snippet given below and select the most appropriate choice.

using System; using System.Collections.Generic; public class Example { public static void Main() { IDictionary<string, string> openWith = new Dictionary<string, string>(); openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); openWith.Add("txt", "notepad.exe"); Console.WriteLine("\nKey Added"); } }

**Problem Statement**

In this problem,you are given a sample of 3 years medical data. It is divided into Cancer, Stroke and Cardio vascular as columns and index respectively. In order to get an insight into this data, you need to find a correlation of each column against other columns in this dataset.

Your final answer would be to find out the maximum correlation of each column against other columns.

Consider a supervised training of a machine learning model where 80% of the training samples are of class C1 and the remaining are of class C2. The training accuracy of this classifier is computed as the ratio of “number of correct prediction” to “total number of predictions made”.

In which of these circumstances could the accuracy of the model be trusted the most?

A dog trainer wants to use reinforcement learning to teach new tricks to a dog at her home. She emulates a situation, and the dog tries to respond in many different ways. If the dog’s response is in the desired way, a treat is given.

Whenever the dog is exposed to the same situation, the dog executes a similar action with even more enthusiasm in expectation of getting more treats. The dog also learns what not do when faced with negative experiences.

In the given scenario, who could be the agent?

The network given below takes state as an input and produces the probability distribution of actions.

What is the relation between the statement given below in this context?

Statement1: The given network is not entirely similar to a Deep Q Network

Statement2: The given network is a classification problem

**Problem Statement**

You are working as a data analyst for the sports column of a leading News Paper Firm. As the 2016 Olympics has recently concluded, you need to publish the medal tally for each country as a bar graph for tomorrow’s sports column.

In this problem, you are given a data set containing medal tally of 21 countries. You need to analyze the data and plot a bar graph of the medals tally under each country.

Consider the tables advisors and students given below.

CREATE TABLE `advisors` ( `advisor_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, PRIMARY KEY (`advisor_id`) ) CREATE TABLE `students` ( `student_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `advisor_id` int(11) DEFAULT NULL, PRIMARY KEY (`student_id`), KEY `advisor_id` (`advisor_id`), CONSTRAINT `students_ibfk_1` FOREIGN KEY (`advisor_id`) REFERENCES `advisors` (`advisor_id`) );

Which of the following query can you use to get the information on students and their advisors, excluding students who are not assigned to an advisor?

You have created an Employee table as follows.

CREATE TABLE Employees ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, TerminationDate DATE, HireDate DATE, Primary Key(ID) );

In the given context, which of these is a correct way to define a constraint that says that the TerminationDate must be after the HireDate?

You are asked to create a data managing system for a package delivery firm in MySQL. It is given that the firm manages salesmen who deliver packages to destination listed by the customer for a particular delivery. You have created the following tables in order to do so.

CREATE TABLE Salesman ( salesman_id INT NOT NULL, name VARCHAR(255) NOT NULL, city VARCHAR(255), comission DOUBLE(255, 2), PRIMARY KEY (salesman_id) ); CREATE TABLE Customer ( customer_id INT NOT NULL, cust_name VARCHAR(255) NOT NULL, city VARCHAR(255), grade INT, salesman_id INT, PRIMARY KEY (customer_id), FOREIGN KEY (salesman_id) REFERENCES Salesman(salesman_id) ); CREATE TABLE Orders ( ord_no INT NOT NULL, purch_amt DOUBLE(255, 2) NOT NULL, ord_date DATE, customer_id INT, PRIMARY KEY (ord_no), FOREIGN KEY (customer_id) REFERENCES Customer(customer_id) FOREIGN KEY (sales_id) REFERENCES Salesman(salesman_id) );

**Orders**

**Customer**

**Salesman**

Create a package as follows

1.Write a function that returns the level of the customer based on the grade(G) as follows:

Level is Silver if 50 <= G <= 150

Level is Gold if 151 <= G <= 300

Level is Diamond if 301 <= G <= 500

2.Write individual stored procedures to do the following

a. List out all the names of all customers with salesman_id equal to 5001, in alphabetical order.

b. Display the details of orders on 5th October 2012.

c. Increase the commission of a salesman by 0.2% if he/she works for a customer in a different city than the one he resides in.

3.Write a function with parameter argument given as sales_id and find the net purchase for the customer whose sales_id is equal to the parameter that is passed to the function.

Perform the above given tasks in your system and upload a doc file containing the solutions for the respective tasks.

You have a text file called **demo** containing the following lines of text in a Linux system.

1. This is the first line of an experiment.

2. It is a text with experiment.

3. Lots of errors are present.

4. So much errors, all these errors are making me sick.

5. This is a line not containing any errors.

6. This is the last line of my experiment.

Now, you are asked to find all the lines containing the search pattern** ‘experiment’** and print the lines matching the pattern in the shell. Which of these shell commands can you use for doing so?

Consider the given code snippet.

class Product { private: string type; Product(string type) { this->type = type; } int getBasePrice() { switch (this->type) { case food: return 10; case drinks: return 7; case books: return 3; default: return 0; } } int getTaxPercent() { switch (this->type) { case food: case drinks: return 24; case books: return 8; default: return 0; } } string getProductCategory() { switch (this->type) { case food: case drinks: return 'Food and Beverages'; case books: return 'Education'; default: return '-'; } } }

You notice that when introducing a new product type in the code, you’ll have to make changes in three different methods of the class. Which of these design smells does the given snippet have?

Which of these functions in the given code snippet depicts a lazy code smell?

#include <iostream> using namespace std; int remainder(int a, int b) //Fun1 { return(a % b); } int add(int a, int b) //Fun2 { return (a + b); } int multiply(int a, int b) //Fun3 { return (a * b); } int main() { int sum; sum = add(100, 78); cout << "100 + 78 = " << sum << endl; mul = multiply(10, 78); cout << "10 * 78 = " << mul << endl; return 0; }

What should be used at **Blank5 **to quit the whole browser session?

What should be used at **Blank4** to replace the value of the header row with an empty string?

What should be used at **Blank3 **to get all the Columns of table with tag ‘td’?

What should be used at **Blank2 **to Get all the Rows of table with tag ‘tr’?

**Blank1 **to create the object of the first table using the xpath “//div[@id=’mw-content-text’]//table[1]” to locate the table?

NoSuchElementException

Which of these can be considered as valid reasons behind the same?

- An invalid memory address reference was made during the call to the element.
- Element cannot be found in the specified interval