answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

What is the return type of and operator in c?

There are two AND operators in C, logical AND (&&) and bitwise AND (&).

The return type for logical AND is always bool, however logical AND only works when both operands can be implicitly cast to bool. The value 0 is always regarded as being false while all non-zero values are regarded as being true.

The return type for bitwise AND is that of the largest of its two operands. For instance, the return type of int & char is int (same as the l-value) while the return type of char & int is also int (same as the r-value).

What is top down stepwise refinement in c?

It is a designing method, but has nothing to do with the C language.

No its a very useful technique of C programming

In top down stepwise refinement we start with a psuedocode (it is actually a puseudocode)

First the "Top"...is a single statement, in effect the complete representation of programme.

but cannot give all the details so we do some refinement

We do refinements in steps, like specifing variables and then again refine them by intializing them with specific or desired numbers or values.

So top down stepwise refinements make it easy for us to design a programme...we divide our program from top to down in segments and refine (or define) these segments.

How do you write c?

There has to be a key on your keyboard, between 'X' and 'V', marked with 'C'. Press it!

Why you use loop in arrays in c plus plus?

We use loops with arrays because it's one the simplest methods of traversing an array. since each element in an array is the same size, every element can be access via an offset from the start of the array, using the array suffix operator []. Arrays employ zero-based offsets because the first element is always at the same address as the array itself. Thus the first element is at offset [0], while the third is at offset [2]. What this means is that if we multiply the size of an element by its offset index, we can determine the address of that element and therefore access that element's value. The subscript operator does this for us automatically, thus giving us constant-time random access to any element in the array. We can also use pointers to manually calculate the address of an element (which is what actually goes on behind the scenes). However, when we wish to traverse the array, one element at a time, a loop is the simplest method of doing so. The loop simply iterates through all the offset indices, beginning with offset 0, then 1, and 2, and so on. The final index is always 1 less than the number of elements in the array, because arrays are zero-based.

What is the net driver to access the database?

Question doesnt make sense. There are tens of database types availible. Each using one or two drivers.

What are real constants in java?

"real" numbers, in any programming language, are actually approximations of what is called a "real number" in math. Basically, a number that can handle decimals - but unlike the actual real numbers, of limited precision.

In Java, the "real" data types are float, and double. double has greater precision.

A "constant" in Java is similar to a variable, but its value can't be changed after it has been assigned a value.

How do you wrte aC program to print calendar?

#include<stdio.h>

#define TRUE 1

#define FALSE 0

int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};

char *months[]=

{

" ",

"\n\n\nJanuary",

"\n\n\nFebruary",

"\n\n\nMarch",

"\n\n\nApril",

"\n\n\nMay",

"\n\n\nJune",

"\n\n\nJuly",

"\n\n\nAugust",

"\n\n\nSeptember",

"\n\n\nOctober",

"\n\n\nNovember",

"\n\n\nDecember"

};

int inputyear(void)

{

int year;

printf("Please enter a year (example: 1999) : ");

scanf("%d", &year);

return year;

}

int determinedaycode(int year)

{

int daycode;

int d1, d2, d3;

d1 = (year - 1.)/ 4.0;

d2 = (year - 1.)/ 100.;

d3 = (year - 1.)/ 400.;

daycode = (year + d1 - d2 + d3) %7;

return daycode;

}

int determineleapyear(int year)

{

if(year% 4 FALSE)

{

days_in_month[2] = 29;

return TRUE;

}

else

{

days_in_month[2] = 28;

return FALSE;

}

}

void calendar(int year, int daycode)

{

int month, day;

for ( month = 1; month <= 12; month++ )

{

printf("%s", months[month]);

printf("\n\nSun Mon Tue Wed Thu Fri Sat\n" );

// Correct the position for the first date

for ( day = 1; day <= 1 + daycode * 5; day++ )

{

printf(" ");

}

// Print all the dates for one month

for ( day = 1; day <= days_in_month[month]; day++ )

{

printf("%2d", day );

// Is day before Sat? Else start next line Sun.

if ( ( day + daycode ) % 7 > 0 )

printf(" " );

else

printf("\n " );

}

// Set position for next month

daycode = ( daycode + days_in_month[month] ) % 7;

}

}

int main(void)

{

int year, daycode, leapyear;

year = inputyear();

daycode = determinedaycode(year);

determineleapyear(year);

calendar(year, daycode);

printf("\n");

}

What is high level to binary language and binary to high level?

High-level to binary is known as compilation or interpretation, depending on whether the entire program is converted at once (compilation) or only one statement at a time is converted (interpretation).

There is no conversion from binary to high level -- it's one-way only.

What parameters decide the size of data type for a processor?

Some bits of machine instruction code. Of course it is platform-dependent.

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"

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.

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 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.