KPIT Cummins Placement Paper January 2012

1. What is the output of the program
#include<stdio.h>
#include<conio.h>
void main()
{
char *st1[3]= {"Hello","World","Oracle"};
*st1=st1[2];
st1[1]=*st1;
free(st1[0]);
free(st1[1]);
clrscr();
printf("%s %s %s",st1,st1[1],st1[2]);
getch();
}
// A. Garbage Garbage Oracle
// B. oracle oracle oracle
// C. Hello World Oracle
// D. Core Dump:cannot Print after freeing the memory
Ans: D
2. What is the output in the following program
main()
{char c=-64;
int i=-32
unsigned int u =-16;
if(c>i)
{printf("pass1,");
if(c
printf("pass2");
else
printf("Fail2");
}
else
printf("Fail1);
if(i
printf("pass2");
else
printf("Fail2")
}
a) Pass1,Pass2
b) Pass1,Fail2
c) Fail1,Pass2
d) Fail1,Fail2
e) None of these
Ans. (c)
3. What will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line number:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
} //Line number 15//
a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1
Ans. (b)
4. What is the max. decimal number that can be accomodated in a byte.
a) 128
b) 256
c) 255
d) 512
Ans: (c)
5. Frequency at which VOICE is sampled is
a) 4 Khz
b) 8 Khz
c) 16 Khz
d) 64 Khz
Ans: (a)
6. find the o/p of the program
void main()
{
int a=10;b;
if(a<=10)
b=4;
if(a>10)
b=5;
cout<
}
(a)it don't be compiled
(b)it compiles and o/ps 10 4(ans)
7. A software that allows a personal computer to pretend as a computer terminal is
a) terminal adapter
b) bulletin board
c) modem
d) terminal emulation
Ans: (d)
8. Memory. Management in Operating Systems is done by
a) Memory Management Unit
b) Memory management software of the Operating System
c) Kernel
Ans: (b)

0 comments:
Post a Comment
Thanks For Your Comment. We Get Back To You As Soon As Possible.