September 24, 2018

Srikaanth

Hewlett Packard R Programming Interview Questions

Hewlett Packard R Programming Recently Asked Interview Questions Answers

How many types of vectors are present in R?

Atomic Vector
Combining Vector
Vector arithmetic
Logical index vector
Numeric index
Duplicate Index
Range Indexes
Out-of-order Indexes
named Vectors Members

What is an Atomic vector and how many types of atomic vectors are present in R?

The atomic vector is the simplest R data type. Atomic vectors are linear vectors of a single primitive type, like an STL Vector in C++. There are four types of atomic vectors are present in R:

Numerical datatype
Integer datatype
Character datatype
Logical datatype
Hewlett Packard R Programming Recently Asked Interview Questions Answers
Hewlett Packard R Programming Recently Asked Interview Questions Answers

What are the disadvantages of R?

In R, quality of some packages is less than perfect.
In R, no one to complain, if something doesn’t work.
R is a software Application that many people devote their own time to developing.
R commands give little thought to memory management, and so R can consume all available memory.

Why R language?

In R, quality of some packages is less than perfect.
In R, no one to complain, if something doesn’t work.
R is a software Application that many people devote their own time to developing.
R commands give little thought to memory management, and So R can consume all available memory.

What is Predictive Analysis in R?

Predictive analysis is the branch of advanced analysis. It used to make predictions about unknown future events. The Predictive analysis contains data collection, statistics, and deployment. It uses many techniques from data mining, statistics, machine learning and analyzes current data to make predictions about future. It also allows the business users to create Predictive intelligence.

What is Predictive analysis process in R?

Define Project – It includes Project outcomes, business objectives, deliverables, scoping of the effects.
Data Collection – For predictive analysis, it collects data from different sources to analysis. Thus it provides a complete view of customer interactions.
Data Analysis – It is the process of cleaning, transforming, inspecting and modeling data. The goal of this process is to discover useful information.
Statistics – This process enables to confirm the assumptions. Hence it uses the assumption to test using a statistical model.
Modeling – An accurate predictive model about future is been created using predictive modeling. There are also options to choose the best model.
Deployment – To deploy the analytical results into everyday decision-making.
Model Monitoring – To ensure that it is providing an expected result, we have to manage model.

What is the need for Predictive Analysis in R?

Secure a competitive Stronghold It helps you to play your competitors’ weaknesses and company’s strengths. Hence, it allows you to check the actions of consumers and your competitors’ marketing and sales.
Do more than evaluating the past Employee analysis helps to check your company details. It will summarize past failure or past success. Therefore, the most important thing is that predictive analysis helps in learning from past experiences.
Maintain business integrity by managing fraud, First of all, Fraud investigators can look into only a set number of cases each week. Secondly, they use company’s past experience to score transactions according to their level of risk.
Advance your core business Capability The next step to growth is to improve company core offering. Thus At its core, it focuses on using it to optimize your approach to the market.

What is Descriptive analysis in R?

It does exactly what the name Implies “Describe”. it allows us to learn from our past and to understand how they might influence future outcomes. The main goal of is to find out the reasons behind previous success or failure in the past. Hence, Most of the social analysis is descriptive analysis. For Example – the company’s production, financials, operations, sales, finance, inventory, and customers.

What is recycling of elements in an R vector? Give an example.

When two vectors of different length are involved in an operation then the elements of the shorter vector are reused to complete the operation. This is called element recycling.

Example – v1 <- c(4,1,0,6) and v2 <- c(2,4) then v1*v2 gives (8,4,0,24). The elements 2 and 4 are repeated.

What is R lists?

Lists are the object which Contains elements of different types – like strings, numbers, vectors and another list inside it. A list can also contain a matrix or a function as its elements. The List is created using list() Function. In other words, a list is a generic vector containing other objects. For Example, The variable x is containing copies of three vectors n, s, b and a numeric value 3.
n = c(2, 3, 5)
s =  c(“aa”,  “bb”,  “cc”,  “dd”, “ee” )
b = c(TRUE,  FALSE,  TRUE,  FALSE,  FALSE )
x = list( n, s, b, 3)        # x contains copies of n, s, b)

Explain how to create a list in R?

Create a list containing string, numbers, vectors and logical values. For Example:

List_data <- list("Green", "Yellow", c(5,6,7), TRUE, 51.2)

print(list_data) When we execute the above code, it produces the following result-

[[1]]
[1] “Green”
[[2]]
[1] “Yellow”
[[3]]
[1] 5, 6, 7
[[4]]
[1] TRUE
[[5]]
[1] 51.2


How to use sapply in R?

Multipy all values by 10:

> sapply(BOD,function(x) 10 * x)
Time demand
[1,] 10 80
[2,] 20 100
[3,] 30 190
Used for array, margin set to 1:

> x <- array(1:9) > sapply(x,function(x) x * 10)
[1] 10 20 30 40 50 60 70 80 90
Two dimension array, margin can be 1 or 2:

> x <- array(1:9,c(3,3)) > x
[,1]   [,2]   [,3]
[1,]      1      4      7
[2,]      2      5      8
[3,]      3      6      9
> sapply(x,function(x) x * 10)
[1] 10 20 30 40 50 60 70 80 90
sapply: returns a vector, matrix or an array
# sapply : returns a vector, an array or matrix

sapply(c(1:3), function(x) x^2)
[1] 1 4 9

What is R matrices?

A matrix is a two-dimensional rectangular data set and thus it can be created using vector input to the matrix function. In addition, a matrix is a collection of numbers arranged into a fixed number of rows and columns. Usually, the numbers are the real numbers. By using a matrix function we can reproduce a memory representation of the matrix in R. Hence, the data elements must be of the same basic type.

How many methods are available to use the matrices?

There are so many methods to solve the matrices like adding, subtraction, negative etc.

What is control structure in R?

R has the standard control structures we would expect. expr can be multiple statements by enclosing them in braces { }. It is more efficient to use built-in functions rather than control structures whenever possible. These allow us to control the flow of execution of a script typically inside of a function. Control structures define the flow of the program. The decision is been based on the evaluation of a variable.

How many control statements are present in R?

There are eight control statements are present in R.

Name all control statements present in R?

If
If-else
For
Nested loops
While
Repeat and break
Next
return.


Subscribe to get more Posts :