Sunday 13 November 2011

20 cprogramming interview questions

20 cprogramming interview questions
This question papers have also important question from mca 2005 model papers.
based on  that try to solve program execute and store the code in your machine.this sampls help you in cprogramming interview also.
1) main( )
{
int c=40 ;
 printf ("%d %d %d %d    c , c«l»2, c&lO, c|100);
)
2) #include <stdio.h>
int a, i = 3; fsum = 0;
main( )
{
for ( ; i>2 ; -i) 1
fsum = fsum + fact(i);
}
printf ("%d \n %d\ i, fsum); i
1
fact(i)
{ if(i==D
return(l);
else
return (i * fact(i-l));
}



3) main( )
{
inta[3]= {1,2, 3.4,5);
printf("%d \n %d \n %d \n %d \n %d'\ a.a+l.a+2,a+3,a+4);
4) main( )
 (
 int x = 5, y = 10; y+= ++x, ++y, x++; x+=y++;
printf("x=%d\n y=%d", x.y);

5) main( )
I char str[] = "computer"; printf("%s \n %s", str, strrev(str, 2)); }
6) main( )
{
int z = 30;
printf("%d %d %d %d'\ z. z«2»3, Z&100, z|10); I
7) muin( )
( int sum, index; sum = 0; index = 9; do | index+=l:
sum = 2* sum; | while(index>9); printf("r/cd %d'\ sum. index): )


8) # define SQUARE (X) (X * X)
main ()
j   int   a = 3, b ;
b =   SQUARE (a + 1); Printf (" % d", b);
)
9) main ()
{    int a = 8 , b = 4   c = 2 ;
a = b » c ;
b = a « c ;
c = c « a » b ; printf ("a = % d \ n b = % d\n c = % d", a, b, c);

}
10) main ()
{    int a;
printf (" % d \ n % d   scanf (" % d", & a), scanf ("%dM, & a)); }
p.T.a




11) main ()
{   int  x = 1, y = 1 ; for<;;)
'' *'    < If (x>5) break ;
else
y = y + x ; printf("%d\y); x=x+y;
}
)
12) main ( )
{   int a[ ] = (2,4,6,8,10); int i;
change (a, 5); for (i = 0 ; i< = 4 ; i + +) printff %d",a[i]);

change (int * b, int n) { int i;
for (i = 0 ; i < n ; i ++) * (b + i) = * (b + i) + 5 ; )



3. Write a program to accept student information (Rollno, name, percentage) for 8 students and display merit list.
4. A) Write a program to display sum of digits of a given number. Use recursion.
B) Write a program to concatenate two given strings without using built-in string functions.
5. Write a program to read the data from DATA.txt file, display every alternate word and total no. of words from file.
6. A) Write program to draw 'n' concentric circles, accept n' from user.

B) Write program to accept 5x5 matrix and display sum of diagonal elements.
7. Write a program to encrypt a text File using 'key'. Accept file name and key as a command line argument.
8. A) Write a program to swap the two strings. Use function swap (char *, char *).

B) Write a program to accept a number and display it's equivalent Hexadecimal number.
9. Write short note on :
A) Storage classes
B) 'C preprocessor.



10. Write a program to accept student information (Rollno, name, percentage) for 10 students and display merit list. Use suitable format.
11. A) Write a program to display sum of digits of a given number. Use recursion.
12) How to Write a program to concatenate two given strings without using built-in string functions.
13.How to Write a program to read the data from DATA.txt file, display every alternate word and total no. of words from file.
15. A) How to Write program to draw 'n' concentric circles, accept n' from user.

16) How to Write program to accept 5x5 matrix and display sum of diagonal elements.
17.How to Write a program to encrypt a text File using 'key'. Accept file name and key as a command line argument.
18.How to A) Write a program to swap the two strings. Use function swap (char *, char *).

19) How to  Write a program to accept a number and display it's equivalent Hexadecimal number.
20)what is Storage classes
21)C preprocessor.

cprogramming new pattern question papers mca

cprogramming new pattern question papers mca
 c programs for Practice Model question paper.  new pattern for MCA.
|  Important Questions .
what will be the output will it gives  right output or there is error in given program find out.

1) main ( )
{
ihi x=4, y = 0. z ; while (x> = 0)
{
if (x = = y) break ; x- -; y + + ;

printf ("x = % d \t y = %d'\ x,y);
)
will it gives error or will give the input.
2) main ( )
(
irit a = 2, b = 3 ; a = + + a *+ + a ; b=++b*b++; a = + + a * + + b ; b = + + b *+ + a ; printf ("a = % d\t h = % d'\ a,b) ;
}
3) main ( )

inl a = a7 ;
int * b = & a ; .
while ( ♦ b! = 100)
I
printf ("%c'\ ,b + + );
)

5) # define SQR (x) x* x
# define CUBE (x) x* x« x
main ()
{
int a, b :
a =2 : b = CUBE ( ++a) / SQR (a ++) printf ( "a = % d \i b = % d" , a, b );   I



write the Answer  of  the followings programs.

a) How to Write a C function X cmp ( const char *. const char *) to accepts two strings
and returns (|) if both strings are equal, returns + 1 if first string is larger,
returns - ! if first string is smaller than second string ?
b) How to   Write C program that illustrates use of type casting and static storage class ?  

a)  How to  Accept the siring and check whether it is palindrome or not without using
string function ? try to execute also.

b)  How to  Write C program to accept the string from user until user enters "ddd", and
display last two strings entered, use dynamic memory allocations.
4. a) Write a C program using recursive function to sum the digits in a number.    
b)  How to  Write a C program to accept 5x5 array of integers and calculate and display
sum of each row.
5.  How to  Write a menu driven program in C to maintain the record of STUDENT file.
Operations performed on files are :
I >To  Add Record 2)To  Modify Record
3) To Delete Record 4) To Display Record.

1) How to   Write the program "Cast. C" that prints last V lines of text file accepted
through command line. 6
2) How to  Write the program in C to copy the contents of file 1 to file 2 skipping all
vowels Irom file 1, write down code also. and execute it.







1. write down the output of following programs.
i) main ()
{
static char str [ ] = "The break down probability of an equipment"; printf (" %s %S %s", str, str + 6, (* (str + 8) - 32);
}
j) main ()
{
inta= 10, b = 20;
printf ("ans = % d", a > b : a*a : b/b); )
k) main ()
{
int x = 3, z: z = x+++ 10;
printf ("x = %d, z ■ %d", x, z); }
l)
#
defme CUBE (X) (X*X*X) main ()
(
int a, b = 3;
a = CUBE (++b / -H-b); printf ("a = %d b = %d", a, b);

m)
main ()
{ static char a f] = "Able was I ere 1 saw elba' char *t, *s, *b; s = a;
b = a+ strlen (a) - 1; K t = b;
while (s ! = t) {
printf ("%c", *s); s++;
prinf("%c", *t); t-;
}
n)
main () { struct a
{
char arr[lO|; char *str;
);
static struct a si = {"Oracle", "Java"); printf("%c %c I n," sl.arr[0|, *sl.str);
)