July 19, 2019

Srikaanth

Accenture R Programming Recently Asked Interview Questions

Explain R graphics devices?

The following devices are currently available:

PDF – Write PDF graphics commands to file.
xfig – Device for XFIG graphics file format.
pictex – Writes TeX/PicTeX graphics commands to a file (of historical interest only).
postscript – Writes PostScript graphics commands to a file.
bitmap – bitmap pseudo-device via Ghostscript (if available).
The following devices will be functional if R was compiled to use them:

png – PNG bitmap device
jpeg – JPEG bitmap device
bmp – BMP bitmap device
tiff – TIFF bitmap device
X11 – The graphics device for the X11 windowing system.
svg – SVG device based on Cairo graphics.
cario.pdf – cairo_ps PDF and PostScript devices based on Cairo graphics.
quartz – The graphics device for the macOS native Quartz 2d graphics system.
Accenture R Programming Recently Asked Interview Questions Answers
Accenture R Programming Recently Asked Interview Questions Answers

Explain how to save graphs in R?

R runs on so many different operating systems. It supports so many different graphics formats.

JPEG – jpeg is been used anywhere but doesn’t resize
PNG – png is been used anywhere but doesn’t resize
WMF – win.metafile Windows only; best choice with Word; easily resizable
PDF – pdf pdflatex; easily resizable
Postscript – Postscript latex and Open Office; easily resizable

How many methods are there to save graphs?

There are three methods to save graphs respectively:

A General method
another approach
Local Sessions with Windows or OS X

How Using Rprof() to Find Slow Spots in Your Code in R?

If our R code is running unnecessarily slowly, a handy tool for finding the

a) Monitoring with Rprof() – We will call Rprof() to get the monitor started, run our code, and then call Rprof() with a NULL argument to stop the monitoring.
b) Profiling R code – Profiling R code gives you the chance to identify bottlenecks and pieces of code that needs to be more efficiently implemented just by changing one line of the code from

x = data.frame(a = variable1, b = variable2)

to

x = c(variable1, variable2)

This big reduction happened because this line of code was called several times during the execution of the function.
c) Using R code profiling functions

rprof is a function included in the base package utils, which is loaded by default.
To use R profiling in our code, we can call this function and specify its parameters, including the name of the location of the log file that will be written. See the help for rprof for details.
Profiling can be turned on and off in your code.

What is TCP/IP in R?

TCP/IP is a set of protocols. It is a primary tech of the internet. When we browse the web, send email, chat online, online gaming, TCP/IP is working underneath.

What is TCP/IP variable SMC-R storage allocations?

Each more RMB that is been allocated for a particular SMC-R link group can accommodate 4 – 32
more TCP connections, depending on the RCVBFRSIZE value of the TCP connections.
More staging buffers are allocated as the volume of application data that is been sent increases.
RMBs, staging buffers, and RDMA receive and send elements are all eligible to be deallocated if the volume of application traffic decreases.

What is vectorization in R?

Vectorized functions are a very useful feature of R, but programmers who are used to other languages often have trouble with this concept at first. A vectorized function works not just on a single value, but on a whole vector of values at the same time. But if you understand the nuts and bolts of vectorization in R, it may help you write shorter, simpler, safer, and yes, the faster code in the first place.

What is bytecode compilation?

Bytecode objects consist of an integer vector representing instruction opcodes and operands, and a generic vector representing a constant pool. The compiler is implemented almost entirely in R, with just a few support routines in C to manage compiled code objects is called compiler interface.

What is the byte in R?

A byte is a data equal to either seven or eight bits depending if it needs error correction (parity)

What is JIT in R?

There are two R packages available that offers Just-in-time compilation to R users: the {jit} package and the {compiler} package.

What is JIT package?

The {jit} package was created by Stephen Milborrow which provides a just-in-time compilation of R loops and arithmetic expressions in loops, enabling such code to run much faster.

What is Preliminaries in R?

R is case sensitive
# is the comment tag
R is installed with a default library/packages. We can add/ import extra Packages to the library using the command library()
To use a library function you must load it first into memory using the command load()
Basic instructions are memory resident (you do not need to load them)
Variable names cannot start with “.” (dot), “+” (plus sign) or “-”(minus sign)

How many types of C/C++ preliminaries are present in R?

There are so many types of C/C++ preliminaries are present in R. some of them are mentioned below:

Tokens
Keywords
identifiers
Basic datatype
User-defined datatype
Derived datatype

Explain in brief preliminaries of C/C++?

a) Tokens – The smallest individual units in a program are known as tokens. It has the following tokens:

Keywords
Identifiers
Constants
Strings
Operators

We can write a program in a C++ using tokens, white spaces and the syntax of the language.

i) Keywords – The keyword implements specific C++ language features. They have explicitly reserved identifiers and can’t be used as names for the program variables or other user-defined program elements. Some of the C++ keywords are illustrated; which are in addition to set of ANSI C keywords.

Asm
Private
Protected
New
Friend
Delete
Operator
inline

ii) Identifiers – Identifiers refer to the names of variables, functions, arrays, classes etc. created by programmers. These are the fundamental need of any language. Each language has its own rules for naming these identifiers. The following rules are common : ( both in C, C++ )

Only alphabetic characters, digits and underscores are permitted.
The name can’t start with a digit.
Uppercase and lowercase letters are distinct.
A declared keyword can’t be used as a variable name. However major difference lies in the limit of the length of a name.
b) Basic datatype
C++ compilers support most of the basic data type supported by ANSI C compilers
Char, float, Int, char, double, void. The purpose of the data type void is contrasting. These include

specifications of the return type of a function not returning any value.
to indicate an empty argument list to a function.
The introduction of generic pointers. E.g. void *gp;
c) User-defined datatype
We use user-defined data type structure & union in C while C++ also permits to define another user-defined data type known as class, that can be used to declare variables

d) Derived data type

Arrays – In C++ the application of arrays is like that of C only exception being the way the character array is initialized.
Functions – The function has undergone major change over in C++. While some of this changes are simple, others just a new way of thinking when organizing our program.Some of these were introduced to make C++ program more readable & reliable
Pointers – Pointers are declared & initialized as in C
int x;
int *pi;
pi=&x; etc.

C++ adds the concept of constant pointer & pointer to constant.
e.g. char *const ptr1 = “NEW” // constant pointer


What does the term”Dreaded for loop” means?

In R, many questions arise how to accomplish various tasks without for loops. There seems to be a feeling that programmers should avoid these loops at all costs.Those who pose the queries usually have the goal of speeding up their code.

Give an example of “Dreaded for loop”?

Ex- Vectorization for speedup

Sometimes, we can use vectorization instead of looping. For example, if x and y are vectors of equal lengths, you can write this:
z <- x + y
This is not only more compact, but even more important, it is faster than using this loop and if we understand the nuts and bolts of vectorization in R, it may help us to write shorter, simpler, safer, and yes, a faster code in the first place.


Subscribe to get more Posts :