What are the different levels of a flow chart?
1)Basic flow chart-shows the main steps in a process for a good overview
2)process flow chart-gives details of a process by listing the main steps and sub-steps
3)developement flow chart- is similar to process flow chart but identifies persons or department involved in a process.
4)oppertunity flow chart- highlights decision making steps and inspection points.
Can you use expressions in switch?
Switch Expression should be an Integer Expression.
Syntax:
switch(integer expression)
{
case constant 1:
do this;
default:
do this;
}
The expression following the keyword switch is any C expression that will yield an Integer value.
It could be an integer constant like 1,2 or 3,or an expression that evaluates to an integer.
To write shell program to check the given number and its reverse are same?
echo "enter the number"
if [ $# -ne 1 ]
then
echo "Usage: $0 number"
echo " I will find reverse of given number"
echo " For eg. $0 12321, I will print 12321"
exit 1
fi
n=$1
rev=0
sd=0
while [ $n -gt 0 ]
do
sd=`expr $n % 10`
rev=`expr $rev \* 10 + $sd`
n=`expr $n / 10`
done
echo "Reverse number is $rev"
How do you Program to calculate the value of pi using Monte Carlo method?
//Program to calculate the value of pi using monte carlo method:
/*
NADEEM AHMAD
MCA 2012
NITISH HOODA
M TECH 2012
SHARDA UNIVERSITY
GREATER NOIDA*/
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<conio.h>
#define SEED 35791246
void main(int argc, char* argv)
{
int niter=0;
double x,y;
int i,count=0; /* # of points in the 1st quadrant of unit circle */
double z;
double pi;
printf("Enter the number of iterations used to estimate pi: ");
scanf("%d",&niter);
/* initialize random numbers */
srand(SEED);
count=0;
for ( i=0; i<niter; i++) {
x = (double)rand()/RAND_MAX;
y = (double)rand()/RAND_MAX;
z = x*x+y*y;
if (z<=1) count++;
}
pi=(double)count/niter*4;
printf("# of trials= %d , estimate of pi is %g \n",niter,pi);
getch();
}
What are the goals of data structure?
To arrange data in a particular manner.these manner or set of rules is defined in the data structure so that the data used in computer systems can properly used at necessary time.
What is the value of an 1868 Meriden B water pitcher?
I had one and sold it for $250. That is generally what people are paying for them.
Which language or routines used in dll files?
DLL files use languages like C or C++, although you'll see C++ more often. You can write your own DLLs to run some code you need if you're willing to learn how to do it. It could be valuable to your project and of course it could make you look good in return
To learn more about data science please visit- Learnbay.co
Write a program to display a table of 5?
#include <stdio.h>
#include<conio>
void main ()
{int a,i:,
printf("\n The Multiplication table of 5 is n"):,
For(i=1;i=20;i++)
Printf("%d",a*i);
getch();
}
If array is full how you apply linear search?
An array in C is structured so that it has no particular size; you have to know ahead of time what the dimensions are.
So, a linear search means that you go from the first element to the last, either finding the element in the table, or going to the very last element and not finding it.
Arrays in C can be zero-terminated, in which case you get the element that does not have a value, and that indicates the value you are searching for is not there.
If the array is not zero terminated then you can calculate the dimension of the array, or apply the sizeof operator times the size of the first element to determine the length of the search.
When your program is in run time mode you can save your program?
If this question is about TurboC for DOS, then no.
Adding polynomials using array in C programming Language?
#include<stdio.h>
#include<stdlib.h>
void display(float **,int);
float** add(float **,float **,int,int,int);
int main()
{
float **p1,**p2,**p3,**p4;
int i,j,n1,n2,k=0,x;
printf("Enter no of terms of a pollynomial:\n");
scanf("%d",&n1);
printf("Enter no of terms of another pollynomial:\n");
scanf("%d",&n2);
p1=(float **) malloc(n1*sizeof(float *));
p2=(float **) malloc(n2*sizeof(float *));
for(i=0;i<n1;i++)
p1[i]=(float *) malloc(2*sizeof(float));
for(i=0;i<n2;i++)
p2[i]=(float *) malloc(2*sizeof(float));
printf("Enter the first pollynomial:\n");
for(i=0;i<n1;i++)
{
printf("\nEnter value and exponent:");
scanf("%f %f",&p1[i][0],&p1[i][1]);
}
printf("Enter the second pollynomial:\n");
for(i=0;i<n2;i++)
{
printf("\nEnter value and exponent:");
scanf("%f %f",&p2[i][0],&p2[i][1]);
}
printf("\nFirst pollynomial:\n");
display(p1,n1);
printf("\nSecond pollynomial:\n");
display(p2,n2);
for(i=0;i<n1;i++)
for(j=0;j<n2;j++)
if(p1[i][1]==p2[j][1])
k++;
x=n1+n2-k;
p3=add(p1,p2,n1,n2,x);
printf("\nAdded polynomial:\n");
display(p3,x);
return 0;
}
void display(float **p,int n)
{
int i;
printf("%fx^%d",p[0][0],(int)p[0][1]);
for(i=1;i<n;i++)
printf("+%fx^%d",p[i][0],(int)p[i][1]);
}
float** add(float **p1,float **p2,int n1,int n2,int n)
{
int i,j,k;
float **p3;
p3=(float **)malloc(n*sizeof(float*));
for(i=0;i<n;i++)
p3[i]=(float *)malloc(2*sizeof(float));
i=0;
j=0;
k=0;
while(i<n1 && j<n2)
{
if(p1[i][1]==p2[j][1])
{
p3[k][0]=p1[i][0]+p2[j][0];
p3[k][1]=p1[i][1];
k++;
i++;
j++;
}
else if(p1[i][1]<p2[j][1])
{
p3[k][0]=p1[i][0];
p3[k][1]=p1[i][1];
k++;
i++;
}
else
{
p3[k][0]=p2[j][0];
p3[k][1]=p2[j][1];
k++;
j++;
}
}
while(i<n1)
{
p3[k][0]=p1[i][0];
p3[k][1]=p1[i][1];
k++;
i++;
}
while(j<n2)
{
p3[k][0]=p2[j][0];
p3[k][1]=p2[j][1];
k++;
j++;
}
return p3;
}
How do you reverse a single linked list in recursive method?
Reversing a singly-linked list is (surprisingly) simple and can be done non-recursively. The following function accepts a reference to the current head of the list and returns the new head after reversing the list.
node* reverse (node* head) {
if (!head) return head;
node *lead, *temp;
lead = head;
while (lead->next) {
temp = lead->next;
lead->next = temp->next;
temp->next = head;
head = temp;
}
return head;
}
Doing the same thing recursively is a bit more tricky but it can be done as follows.
node* reverse (node* head, node* prev=NULL) {
node* temp;
if (!head) {
return head;
} else if (!head->next) {
head->next = prev;
return head;
} else {
temp = head->next;
head->next = prev;
return reverse (temp, head);
}
}
What function will read a specified number of elements from a file in c?
fread() function will read a specified number of elements from a file .
160 and 192.
How do you remove duplicate rows from a matrix using C language?
Sort the rows; the duplicates will then be grouped together. Scan from the top row; if the next row is a duplicate of the current row, remove it. If the next row is not a duplicate, make it the current row. Repeat until there is no next row. When complete, all the duplicates will have been removed.
Find an example or a recursive procedure and represent it as an iterative procedure?
int recursiveNFactorial (int n) {
if (n < 2) return 1;
if (n == 2) return n;
else return n * recursiveNFactorial (n - 1);
}
int iterativeNFactorial (int n) {
int result = 2;
if (n < 2) return 1;
while (n > 2) result *= n--;
return result;
}
For an if then else loop how do you include more than one condition?
You can combine more than one condition with AND or with OR. How this is written depends on the particular programming language.
You can also have several cases; example in Java:
if (condition1)
{
command1;
}
else if (condition2)
{
command2;
{
else
{
command3;
}
Follow the backslash with another backslash:
System.out.println("\\ " \");
will display \ " \ on the screen.
Number of all possible binary trees with 2 nodes is?
Two:
1. root and left child
2. root and right child
In c plus plus what are the three ways that classes can relate to each other?
Class wrappers (embedded objects), inheritance (derived objects) and friend classes.
What is automatic variable and what is its use?
It is a local variable known only to the function in which it is declared. Auto is the default storage class.