Sunday, 28 November 2010
Interview Questions for Cap Gemini IT Infrastructure
Total 2 Rounds:
1. Online Test for Cap Gemini
2. Technical and HR Round
IT Infrastructure HR Round Questions
Technical Round Questions as follows:
C Section
About C?
Describe about 'C'
What is Debugging
What are Different types of OS
Write a basic 'C' Program
What are Different types of Networks
Java Section
What is the difference between C and C++
Why java is platform Independent
What is Buffered Reader
Constructor, Binding, Inheritance, Eneap
what is abstraction?
What is encapsulation?
What is static Binding?
Threads
what is abstraction?
Storage Classes
What is polymorphism?
What is java
Difference between c,c++, and Java
Database Section
What is database
How data is Stored in Database?
Difference between Structure & Union?
Difference between C & Java?
Constructor, Binding, Inheritance, Eneap
DDL, DML, TCL
What are Different types of Networks
What is NSSB?
MicroProcessor and Controllers
Describe the Difference between MicroProcessor and Microcontrollers?
Saturday, 27 November 2010
wap to read an 2d array and display
1) wap to read an 2d array and display */
#include<conio.h>
#include<stdio.h>
void main()
{
int a[2][3];
int i,j;
printf("enter the elements in 2d array\n");
for(i=0;i<=2-1;i++)
{
for(j=0;j<=3-1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("2d array is\n");
for(i=0;i<=2-1;i++)
{
for(j=0;j<=3-1;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
getch();
}
c program examples
#include<conio.h>
#include<stdio.h>
void main()
{
int a[2][3];
int i,j;
printf("enter the elements in 2d array\n");
for(i=0;i<=2-1;i++)
{
for(j=0;j<=3-1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("2d array is\n");
for(i=0;i<=2-1;i++)
{
for(j=0;j<=3-1;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
getch();
}
c program examples
transpose of a matrix
/* transpose of a matrix */
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5][5];
int i,j,m,n,temp;
m=3;n=3;
clrscr();
printf("enter the size of the first matrix (m,n)\n");
scanf("%d%d",&m,&n);
printf("enter the elements into 1array\n");
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
scanf("%d",&a[i][j]);
}
}
//transpose logic
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
if(i<j)//swapping values above diagnols with those below diagnols
{
temp=a[i][j];
a[i][j]=a[j][i];
a[j][i]=temp;
} //end of if
}//end of inner loop
} //end of outer
//displaying the tranpose matrix
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
printf("%d\t",a[i][j]);
}//inner loop
printf("\n");
}//outer loop
getch();
}
/*
i/p:
o/p:
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5][5];
int i,j,m,n,temp;
m=3;n=3;
clrscr();
printf("enter the size of the first matrix (m,n)\n");
scanf("%d%d",&m,&n);
printf("enter the elements into 1array\n");
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
scanf("%d",&a[i][j]);
}
}
//transpose logic
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
if(i<j)//swapping values above diagnols with those below diagnols
{
temp=a[i][j];
a[i][j]=a[j][i];
a[j][i]=temp;
} //end of if
}//end of inner loop
} //end of outer
//displaying the tranpose matrix
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
printf("%d\t",a[i][j]);
}//inner loop
printf("\n");
}//outer loop
getch();
}
/*
i/p:
o/p:
*/
product of a matrix or Matrix multiplication
/*product of a matrix or Matrix multiplication */
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3];
int b[3][2];
int c[5][5];
int i,j,k,m,n,p,q;
clrscr();
printf("enter the size of the first matrix (m,n)\n");
scanf("%d%d",&m,&n);
printf("enter the size of the 2nd matrix (p,q)\n");
scanf("%d%d",&p,&q);
printf("enter the elements into 1array\n");
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter the elements into 2array\n");
for(i=0;i<=p-1;i++)
{
for(j=0;j<=q-1;j++)
{
scanf("%d",&b[i][j]);
}
}
if(n==p)//1st matrix colm must be equal to 2nd matrix row size
{
//processing the product of two matrix
for(i=0;i<=m-1;i++)
{
printf("\n");
for(j=0;j<=q-1;j++)
{
c[i][j]=0;//initializing matrix c with zeros
for(k=0;k<=n-1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf("%d\t",c[i][j]);
}
printf("\t");
}//outer loop
}//if
else
printf("matrix can not be multiplied");
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3];
int b[3][2];
int c[5][5];
int i,j,k,m,n,p,q;
clrscr();
printf("enter the size of the first matrix (m,n)\n");
scanf("%d%d",&m,&n);
printf("enter the size of the 2nd matrix (p,q)\n");
scanf("%d%d",&p,&q);
printf("enter the elements into 1array\n");
for(i=0;i<=m-1;i++)
{
for(j=0;j<=n-1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter the elements into 2array\n");
for(i=0;i<=p-1;i++)
{
for(j=0;j<=q-1;j++)
{
scanf("%d",&b[i][j]);
}
}
if(n==p)//1st matrix colm must be equal to 2nd matrix row size
{
//processing the product of two matrix
for(i=0;i<=m-1;i++)
{
printf("\n");
for(j=0;j<=q-1;j++)
{
c[i][j]=0;//initializing matrix c with zeros
for(k=0;k<=n-1;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf("%d\t",c[i][j]);
}
printf("\t");
}//outer loop
}//if
else
printf("matrix can not be multiplied");
getch();
}
Friday, 26 November 2010
Write a C program in ‘c’ to find given positive number is prime number or not.
Write a C program in ‘c’ to find given positive number is prime number or not.
Ans:
#include<stdio.h>
#include<conio.h>
void main()
{
int I,n;
int I,n;
int ctr=0;
printf(“enter any no\n”);
scanf(“%d”&n);
for(i=1;<=n;i++)
{
if(n%i==0)
{
ctr++;
}
}
if(ctr==2)
{
printf(“%d is prime no\n”);
}
else
else
{
printf(“%d is not a prime no\n”);
}
getch();
write a recursive function to reverse a string
//write a recursive function to reverse a string
#include<stdio.h>
#include<conio.h>
void main()
{
void reverse();
clrscr();
printf("enter any string\n");
reverse();
getch();
// scanf("%d");//but we need to enter any value or letter to see o/p
}
//
void reverse()
{
char ch;
ch=getchar();
if(ch!='\n')
{
reverse();
printf("%c",ch);
//putchar(ch);
}
}
#include<stdio.h>
#include<conio.h>
void main()
{
void reverse();
clrscr();
printf("enter any string\n");
reverse();
getch();
// scanf("%d");//but we need to enter any value or letter to see o/p
}
//
void reverse()
{
char ch;
ch=getchar();
if(ch!='\n')
{
reverse();
printf("%c",ch);
//putchar(ch);
}
}
write a recursive function for n
write a recursive function for n
Output:
1. Enter the number : 5 Factorial of number: 120
2. Enter the number : 3 Factorial of number: 6
3. Enter the number : 9 Factorial of number: -30336
Conclusion: the program is error free
VIVA QUESTIONS:
1) What is the meaning of factorial number?
Ans : Factorial of a number is nothing but the multiplication of numbers from
a given number to 1
2) What is the meaning of recusive function ?
Ans: A function call it self is called recursive function
3) Define library functions ?
Ans: The functions have already been written, compiled and placed in libraries and are called library functions.
4) Define formal parameters ?
Ans: Formal parameters are the parameters given in the function declaration as function definition.
long double fact(int n)
{
if(n>0)
return(n*fact(n-1));
else
return(1);
}
main()
{
int n;
long double fact(int);
printf("enter any +ve integer (or) 0\n");
scanf("%d",&n);
printf("%d!=%Lf\n",n,fact(n)) ;
getch();
}
1. Enter the number : 5 Factorial of number: 120
2. Enter the number : 3 Factorial of number: 6
3. Enter the number : 9 Factorial of number: -30336
Conclusion: the program is error free
VIVA QUESTIONS:
1) What is the meaning of factorial number?
Ans : Factorial of a number is nothing but the multiplication of numbers from
a given number to 1
2) What is the meaning of recusive function ?
Ans: A function call it self is called recursive function
3) Define library functions ?
Ans: The functions have already been written, compiled and placed in libraries and are called library functions.
4) Define formal parameters ?
Ans: Formal parameters are the parameters given in the function declaration as function definition.