Wednesday, 7 November 2007

Frequently asked questions of c programming with answer

Using only c programming language



check given number is prime number or not using
check the given number is armstrong number or not
check the given number is palindrome number or not

CHECKING LEAP YEAR

CHECK STRING IS PALINDROME OR NOT

PASSING ONE-DIMENSIONAL ARRAY TO A FUNCTION
CREATE A FILE AND STORE DATA IN IT 

TO PASSING 2-DIMENSIONAL ARRAY TO A FUNCTION

WRITING OF STRINGS TO A FILE

Thursday, 13 September 2007

C best coding questions with answer

(q) What will be output of the following program ?   #include"stdio.h" void  main(){ long double a=55555; clrscr(); printf("%.2LE,%.2Le",a); getch();   }   output:5.56E+04,5.56e+04 %e or %E represent print the number in exponential format. %e means output has small letter e. %E means output has capital letter e.   (q) What will be output of the following program ?   #include"

C best language questions and answer

(q) What will be output of the following program ?   #include"stdio.h" void  main(){ char a='\377'; clrscr(); printf(2+"%d%o",a); getch();   }   output:177777 Explanation: ‘\377’ is octal character constant. %o is used to print octal number system. (q) What will be output of the following program ?   #include"stdio.h" void  main(){ char a='\378'; clrscr(); printf("%o",a);

C coding good questions and answer



C coding good questions and answer



(1) What
will be output of the following code?



#include"stdio.h"

void  main(){

char
a='\\';

clrscr();

a=a-'/';

printf("%d",a);

getch();



}



Output: error



Explanation:

Character is \ has special meaning
in c programming. For example:



‘\0’ represents octal character.

‘\n’ represents new line character.
So we cannot use ‘\’ directly.



(2

C good questions and answer




Good questions in c programming language.



(1) What will be output
of the following program?



void  main(){

enum data{a,b,c};

clrscr();

printf("%i %i %i",a,b,c);

getch();

}



Output: 0 1 2

Explanation:

By default initial
value of first enum constant is zero. Value of next enum constant
will be:

Next_enum_constant_value=previous_enum_constant_value+1



(2) What will be output
of

good questions of c with answer



Volatile modifier keyword
questions in c programming language:

(q) What will be output of the
following program?



void main()

{

volatile a=5;

a=~a+ ++a;

clrscr();

printf("%d",a);

getch();

}

Output: -1

Explanation: 

Volatile variable can be modifying by interrupt or other
process in preprocessor. So in normal output will not affect.

Note. ~ is one’s complement operator



(q) What

Saturday, 1 September 2007

Properties of constructor in c++ with example

Properties of constructor:
(1) Constructor is special type function which must has same name of class name.
(2) Constructor doesn’t return any data type even void
Example:
#include
#include
class school
{
char *name;
int capacity;
public:
void school();
void display()
{
cout<
#include
class math
{
int a;
float b;
public:
math(int p,float q) //constructor should be in