Solved Placement Question Paper 2015
1) Write a Program for the following pattern?
if input = 2
pattern:
1*2
3*4
if input = 5
pattern:
1*2*3*4*5
6*7*8*9*10
11*12*13*14*15
16*17*18*19*20
21*22*23*24*25
C Program:
#include< stdio.h >
#include< conio.h >
void main( )
{
int n, i, p;
clrscr( );
printf("\nEnter N Value: ");
scanf("%d",&n);
p = n*n;
for(i = 1; i<= p; i++)
{
if(i <= p)
{
printf("%d",i);
if((i < p) && (i % n != 0))
{
printf("*");
}
}
if(i % n == 0)
{
printf("\n");
}
}
getch( );
}
2) What is the output of the following program?
#include< stdio.h >
#include< conio.h >
void main( )
{
int i = 65;
printf("%d %o %x",i,i,i);
}
Answer: 65 101 41
3) In breadth-first-search(BFS) search, which of the following option is correct?
Answer: It is begining from node and first all its adjacent nodes are traversed.
0 comments:
Post a Comment