Interview Questions
Interview Questions
HCL
1.which of the following involves context switch,(HCL)
a) system call b)priviliged instruction
c)floating poitnt exception
d)all the above
e)none of the above
ans: a
Honeywell
6)Why paging is used ?
17) To ensure one pgm. doesnt corrupt other pgm. in a Multi-pgm. enviornment
what you should do?
19. A qn to find the physical address from a given virtual address, virtual
to physical address table was provided
20 Scheduling Preemptive
22) which one of following is not memory management model? given buddy system,
monitors, paging, swapping Ans. Monitors
24) given page table,page size and offset find the corresponding
physical address ?
ans : a (3*1024+576) (pageno*pagesize+offset)
main()
{
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is : %s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these
Ans) b
INTEGRA
41) If you undelete a file in unix or dos can you recover it?
If you can how will you do it?
42) Which page replacement algo. is the best one? ie. the one which
will give less page faults, assuming cache memory is not there.
Ans : a
45) Critical section is
[a]
[b] statements which are accessing shared resourses
Ans : b
46) load a
mul a
store t1
load b
mul b
store t2
mul t2
add t1
Ans : a**2+b**4
60widget in x-windows is
61)adget in x_windows is
63)s -windows is
a)multitasking
b) c) d)
dynimic scoping is
67) Most of the Windows operating systems are....choices are given like
----a,maltitasking,multiuser,multi processing
b,only.......&......
c,only........&......
like that
86)What is a semaphore?
87)What exactly happens after each system call in sockets, both at the
client and at the server.
89) What is best data structure to store the processes info in a real time operating
system?
94)what is a kernel,shell.
Ans : a
8) MS windows 3.1 is a
a)operating system
b)Application
c)Programing language
d)database
e)shell
(Ans will be b)
17) which function is the entry point for a DLL in MS Windows 3.1
a) main
b) Winmain
c) Dllmain
d) Libmain
e) None
Ans) b
18) .function to repaint a window immediately?.
23)About fork()?
UNIX
1)The command ......ln/bin/mail /usr/you/bin/m
a)will not be executed because you are linking files
5)The UNIX system call that transforms an executable binary file into
a process is
a)execl()
b)execv()
c)execle()
d)execve()
e)All of the above
(Ans will be e check)
IBM
8)Which of the following message is used to initialize the
contents of a dialog
a)WM_CREATE
b)WM_SIZE
c)WM_COMMAND
d)WM_INITDIALOG
e)none
(Ans will be d)
13) The very first process created by the kernal that runs
till the kernal process is haltes is
a)init
b)getty
c)
d)
e)none
(Ans is a)
14)In the process table entry for the kernel process, the process id value
is
a) 0 b) 1 c) 2 d) 255 e) it does not have a process table entry
Ans) a
16) The standard source for standard input , standard output and standard
error is
a) the terminal
b) /dev/null
c) /usr/you/input, /usr/you/output/, /usr/you/error respectively
total 3
15768 -rw-rw-rw- 2 you 29 Sep 27 12:07 old
15768 " " " " " " " " new
15274 " " 1 " 40 " " 09:34 veryold
which of the following is true
a)old and new have same i-node number,2
b) " " " " " " " , 15768
c)old and new have nothing yo do with each other
d)very old and new are linked
e)very old and old are linked
(Ans is b)
24)The UNIX system call that transforms an executable binary file into
a process is
a)execl()
b)execv()
c)execle()
d)execve()
e)All of the above
(Ans will be e check)
32) The very first process created by the kernal that runs
till the kernal process is haltes is
a)init
b)getty
c)
d)
e)none
(Ans is a)
34) The standard source for standard input , standard output and standard error is
a) the terminal
b) /dev/null
c) /usr/you/input, /usr/you/output/, /usr/you/error respectively
d) NOne
Ans) a
39) Max relaxable permisssion value with out giving write permission
to others?.
2.main
{
int x,j,k;
j=k=6;x=2; ans x=1
x=j*k;
printf("%d", x);
3. fn f(x)
{ if(x<=0)
return; ans fn(5) ....?
else f(x-1)+x;
}
4. i=20,k=0;
for(j=1;j<i;j=1+4*(i/j))
{
k+=j<10?4:3;
}
5. int i =10
main()
{
int i =20,n;
for(n=0;n<=i;)
{
int i=10
i++;
}
printf("%d", i); ans i=20
6. int x=5;
y= x&y
( MULTIPLE CHOICE QS)
ans : c
7. Y=10;
if( Y++>9 && Y++!=10 && Y++>10)
printf("........ Y);
else printf("".... )
ans : 13
ans : a
9. if x is even, then
(x%2)=0
x &1 !=1
x! ( some stuff is there)
ans: b and d
16)
main()
{
int var=25,varp;
varp=&var;
varp p = 10;
fnc(varp)
printf("%d%d,var,varp);
}
(a) 20,55(b) 35,35(c) 25,25(d)55,55
static i=10;
printf("%d",i);
}
24. c programs
func() {
static int i = 10;
printf("%d",i);
i++;
}
27)Strings in Java
a)Mutable
b)variable length string
c)...
d)....
29. f(*p)
{
p=(char *)malloc(6);
p="hello";
return;
}
main()
{
char *p="bye";
f(p);
printf("%s",p);
}
what is the o/p?
ans:bye
36)size of(int)
a) always 2 bytes
b) depends on compiler that is being used
c) always 32 bits
d) can't tell
main() main()
{ {
int fact; int fact=0
long int x; for(i=1;i<=n;i++)
fact=factoral(x); fact=fact*i;
} }
if(x>1) return(x*factorial(x-1);
}
a) program 1;
b) program 2;
c) both 1 &2
d) none
38) main(){
char str[5]="hello";
if(str==NULL) printf("string null");
else printf("string not null");
}
what is out put of the program?
a) string is null b) string is not null c) error in program d) it executes but p
rint nothing
40)
void f(int *p){
static val=100;
val=&p;
}
main(){
int a=10;
printf("%d ",a);
f(&a);
printf("%d ",a);
}
what will be out put?
a)10,10
41)
struck a{
int x;
float y;
char c[10];
}
union b{
int x;
float y;
char c[10];
}
which is true?
a) size of(a)!=sizeof(b);
b)
c)
42)
# define f(a,b) a+b
#defiune g(c,d) c*d
43)
main()
{
char a[10]="hello";
strcpy(a,'\0');
printf("%s",a);
}
out put of the program?
a) string is null b) string is not null c) program error d)
a) b) c) d)
45) main()
{
fork();
fork();
fork();
printf("\n hello");
}
How many times print command is executed?
46)main()
{
int i,*j;
i=5;
j=&i;
printf("\ni= %d",i);
f(j);
printf("\n i= %d",i);
}
void f(int*j)
{
int k=10;
j= &k;
}
output is
a 5 10
b 10 5
c55
d none
if(strcmp(s,NULL)== 0)
printf("\n s is null")p
else
printf("\n s is not null");
}
IBM
char *t;
t=x;
x=y;
y=t;
printf("-(%s, %s)",x,y);
}
void swap (char *x,char *y)
{
char *t;
y=x;
x=y;
y=t;
}
a).(New,Dictionary)-(New,Dictionary)
b).(Dictionary,New)-(New,Dictionary)
c).(New,Dictionary)-(Dictionary,New)
d).(Dictionary,New)-(Dictionary,New)
e).None of the above
(Ans will be b or e) check
total 3
15768 -rw-rw-rw- 2 you 29 Sep 27 12:07 old
15768 " " " " " " " " new
15274 " " 1 " 40 " " 09:34 veryold
64) In the following code segment what will be the result of the function,
value of x , value of y
{
unsigned int x=-1;
int y;
y = ~0;
if(x == y)
printf("same");
else
printf("not same");
}
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
e) not same, MAXINT, MAXUNIT
Ans) a
main()
{
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
char *t;
t=x;
x=y;
y=t;
printf("-(%s, %s)",x,y);
}
void swap (char *x,char *y)
{
char *t;
y=x;
x=y;
y=t;
}
a).(New,Dictionary)-(New,Dictionary)
b).(Dictionary,New)-(New,Dictionary)
c).(New,Dictionary)-(Dictionary,New)
d).(Dictionary,New)-(Dictionary,New)
e).None of the above
(Ans will be b or e) check
74) What will be the result of the following segment of the program
main()
{
char *s="hello world";
82) In the process table entry for the kernel process, the process id value is
a) 0 b) 1 c) 2 d) 255 e) it does not have a process table entry
Ans) a
84) In the following code segment what will be the result of the function, value of x , value of y
{
unsigned int x=-1;
int y;
y = ~0;
if(x == y)
printf("same");
else
printf("not same");
}
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
e) not same, MAXINT, MAXUNIT
Ans) a
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
1)
int i;
if i=0 then i:=1;
if i=1 then i:=0;
2)
3)
int i;
if i=0 then i:=1;
else if i=1 then i:=0;
(given that i can take only two values (1,0))
4)
int m,j,i,n;
for i:=1 to n do
m:=m+j*n
a) Array overbound
b) Undeclared identifier
c) stack underflow
d) Accessing an illegal memory location
f(x,y,z)
{
y := y+1;
z := z+x;
}
main()
{
int a,b;
a := 2
b := 2;
f(a+b,a,a);
print a;
}
what is the value of a printed for three different calls in main.
loop:
if(i = 0)
i++;
i++;
j++;
if(j<= 25)
96) 10,20,30,40,50,60 : give the order when put in a queue and in a stack
Ans : Queue : 10,20,30,40,50,60
stack : 60,50,40,30,20,10
99)a problem with a function named 'myValue' will be given and asked to
find the value of main() for an argument of 150,
Ans : 150
MBT
101)
#include <stdio.h>
* What is wrong in the following problem
main() {
int i,j;
j = 10;
i = j++ - j++;
printf("%d %d", i,j);
}
ans: 0, 12
102)
#include <stdio.h>
* What is the output of the following problem
main() {
int j;
for(j=0;j<3;j++)
foo();
}
foo() {
103)
#include <stdio.h>
#include <stdio.h>
#include <string.h>
/* This is asked in PCS Bombay walk-in-interview
* What is wrong in the following code
*/
main()
{
char *c;
c = "Hello";
printf("%s\n", c);
}
/*ans:- Hello, The code is successfully running */
104)
#include <stdio.h>
/* This problem is given in PCS BOMBAY walk-in-interview.
* What is the final value of i and how many times loop is
* Executed ?
*/
main()
{
int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 >\n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k--,i++)
for(l=0;l<j;l++) { lc++;
printf("%d %d\n",i,l);}
printf("LOOPS= %d\n", lc-1);
}
/* Ans: i = 16, and loop is executed for 169 times */
105)
#include <stdio.h>
/* This is given in PCS Bombay walk-in-interview */
/* What is the output of the following program */
main() {
union {
int a;
106)
#include <stdio.h>
main()
{
float i, j;
scanf("%f %f", &i, &j);
printf("%.2f %.3f", i, j);
}
107)
#include <stdio.h>
/* This is given in PCS Bombay walk-in-interview
* What is the out put of the following problem ?
*/
main()
{
char *str = "12345";
printf("%c %c %c\n", *str, *(str++), *(str++));
}
/* Ans: It is not 1 2 3
* But it is 3 2 1 Why ??
*/
108)
#include <stdio.h>
/* This problem is asked in PCS Bombay Walk-in-interview
* Write a macro statement to find maximum of a,b
*/
#define max(a,b) (a>b)?a:b
main()
{
int a,b;
a=3;
b=4;
printf("%d",max(a,b));
}
/* Ans is very simple the coding is just for testing it
and output is 4 */
109)
#include <stdio.h>
/* This problem is asked in PCS Bombay
main()
{
int len=4;
char *st="12345678";
st = st -len;
printf("%c\n",*st);
}
/* Ans : It will print some junk value */
110)
#include <stdio.h>
main()
{
func(1);
}
func(int i){
static char *str ={ "One","Two","Three","Four"};
printf("%s\n",str[i++]);
return;
}
/* Ans:- it will give warning because str is pointer to the char but
it is initialized with more values
if it is not considered then the answer is Two */
111)
#include <stdio.h>
main()
{
int i;
for (i=1;i<100; i++)
printf("%d %0x\n",i,i);
}
/* Ans:- i is from 1 to 99 for the first format,
for the second format 1to9, ato f, 10 to 19,1ato1f, 20 to 29, etc */
113)
#include <stdio.h>
/* This problem is asked in PCS Bombay walk-in-interview
* In the following code please write the syntax for
* assing a value of 10 to field x of s and id_no 101 of s
*/
struct {
int x;
int y;
union {
int id_no;
char *name;
}b;
}s,*st;
main()
{
st = &s;
st->x=10;
114)
#include <stdio.h>
/* This problem was asked in PCS Bombay in a walk-in-interview
* Write a recursive function that calculates
* n * (n-1) * (n-2) * ....... 2 * 1
*/
main() {
int factorial(int n);
int i,ans;
printf("\n Enter a Number:");
scanf("%d",&i);
ans = factorial(i);
printf("\nFactorial by recursion = %d\n", ans);
}
int factorial(int n)
{
if (n <= 1) return (1);
else
return ( n * factorial(n-1));
}
115)
#include <stdio.h>
/* This problem is asked in PCS Bombay walk-in-interview
* What is the output of the following problem
*/
main(){
int j,ans;
j = 4;
ans = count(4);
printf("%d\n",ans);
}
int count(int i)
{
if ( i < 0) return(i);
else
return( count(i-2) + count(i-1));
}
116)
#include<stdio.h>
main()
{
int i=4;
if(i=0)
printf("statement 1");
117)
#include <stdio.h>
* What is wrong in the following problem
main() {
int i,j;
j = 10;
i = j++ - j++;
printf("%d %d", i,j);
}
ans: 0, 12
118)
#include <stdio.h>
* What is the output of the following problem
main() {
int j;
for(j=0;j<3;j++)
foo();
}
foo() {
static int i = 10;
i+=10;
printf("%d\n",i);
}
119)
#include <stdio.h>
#include <stdio.h>
#include <string.h>
/* This is asked in PCS Bombay walk-in-interview
* What is wrong in the following code
*/
main()
{
char *c;
c = "Hello";
printf("%s\n", c);
}
/*ans:- Hello, The code is successfully running */
{
int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 >\n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k--,i++)
for(l=0;l<j;l++) { lc++;
printf("%d %d\n",i,l);}
printf("LOOPS= %d\n", lc-1);
}
/* Ans: i = 16, and loop is executed for 169 times */
121)
#include <stdio.h>
/* This is given in PCS Bombay walk-in-interview */
/* What is the output of the following program */
main() {
union {
int a;
int b;
int c;
} u,v;
u.a = 10;
u.b = 20;
printf("%d %d \n",u.a,u.b);
}
/* Ans : The latest value assigned to any of the union member
will be present in the union members so answer is
20 20
*/
122)
#include <stdio.h>
main()
{
float i, j;
scanf("%f %f", &i, &j);
printf("%.2f %.3f", i, j);
}
123)
#include <stdio.h>
/* This is given in PCS Bombay walk-in-interview
* What is the out put of the following problem ?
*/
123)
#include <stdio.h>
/* This problem is asked in PCS Bombay Walk-in-interview
* Write a macro statement to find maximum of a,b
*/
#define max(a,b) (a>b)?a:b
main()
{
int a,b;
a=3;
b=4;
printf("%d",max(a,b));
}
/* Ans is very simple the coding is just for testing it
and output is 4 */
124)
#include <stdio.h>
/* This problem is asked in PCS Bombay
* What is the output of the following coding
*/
main()
{
int len=4;
char *st="12345678";
for(i=0; i<6; i++)
st = st -len;
printf("%c\n",*st);
}
/* Ans : It will print some junk value */
125)
#include <stdio.h>
main()
{
func(1);
}
func(int i){
static char *str ={ "One","Two","Three","Four"};
printf("%s\n",str[i++]);
return;
}
/* Ans:- it will give warning because str is pointer to the char but
it is initialized with more values
if it is not considered then the answer is Two */
127)
#include <stdio.h>
/* This problem is asked in PCS Bombay walk-in-interview
* In the following code please write the syntax for
* assing a value of 10 to field x of s and id_no 101 of s
*/
struct {
int x;
int y;
union {
int id_no;
char *name;
}b;
}s,*st;
main()
{
st = &s;
st->x=10;
st->b.id_no = 101;
printf("%d %d\n",s.x,s.b.id_no);
}
/* Ans: The answer is st->x=10;
* st->b.id_no=101;
*/
128)
#include <stdio.h>
/* This problem was asked in PCS Bombay in a walk-in-interview
* Write a recursive function that calculates
* n * (n-1) * (n-2) * ....... 2 * 1
*/
main() {
int factorial(int n);
int i,ans;
printf("\n Enter a Number:");
scanf("%d",&i);
ans = factorial(i);
printf("\nFactorial by recursion = %d\n", ans);
}
int factorial(int n)
{
if (n <= 1) return (1);
129)
#include <stdio.h>
/* This problem is asked in PCS Bombay walk-in-interview
* What is the output of the following problem
*/
main(){
int j,ans;
j = 4;
ans = count(4);
printf("%d\n",ans);
}
int count(int i)
{
if ( i < 0) return(i);
else
return( count(i-2) + count(i-1));
}
130)
#include<stdio.h>
main()
{
int i=4;
if(i=0)
printf("statement 1");
else
printf("statement 2");
}
/* statement 2 */
132) One questin is given, long one, to find the answer U should be
femiliar with the operation as follows
int *num={10,1,5,22,90};
main()
{
int *p,*q;
int i;
p=num;
q=num+2;
i=*p++;
print the value of i, and q-p, and some other operations are there.
}
how the values will change?
a. error at runtime
b. compilation error
c.2 3
d. 3 2
136)
#define scanf "%s is a string"
main()
{
printf(scanf,scanf);
}
what is the output.
137)
i=2+3,4>3,1;
printf("%d"i);
ans is 5 only.
138)
char *p="abc";
char *q="abc123";
while(*p=*q)
{
print("%c %c",*p,*q);
}
a. aabbcc
b. aabbcc123
c. abcabc123
d. infinate loop ( this may be correct)
140)
#define void int
int i=300;
void main(void)
{
int i=200;
{
int i=100;
print the value of i;
}
print the value of i
}
what is the output?
141)
int x=2;
x=x<<2;
printf("%d ",x);
ANS=8;
142)
144) When the fn. is called where the return add. is stored?
ans. stack
151) supposing thaty each integer occupies 4 bytes and each charactrer
1 byte , what is the output of the following programme?
#include<stdio.h>
main()
{
int a[] ={ 1,2,3,4,5,6,7};
char c[] = {' a','x','h','o','k'};
printf("%d\t %d ", (&a[3]-&a[0]),(&c[3]-&c[0]));
}
ans : 3 3
ans : 9 6 3 8 5 2 7 4 1
154)
fun(n);
}
int fun( int n)
}
howmany times is the printf statement executed for n=10?
ans: zero
expl: Befire reaching to printf statement it will goes to infinite loop.
ans:5
expl: here it evaluates as a++ + b.
159) which of the following is the correct declaration for the function main() ?
ans: main( int , char *[])
161) printf("%d%x\n",ox2,12);
163)enum
{ELLIPSE,
TRIANGLE,
RECTANGLE,
SQUARE=100,
CIRCLE=5
}
printf{"%d%d%d%d\n",TRIANGLE-RECTANGLE,SQUARE*CIRCLE-RECTANGLE};
170)
main()
{
int i=10;
printf("%d",i);
{
int i=20;
printf("%d",i);
}
printf("%d",i);
}
171)struct class
{
int i;
float a;
string[12];
}
sizeof(class)=?
173) fact(5)
int n;
fact(n)
{
sum=n*fact(n-1);
}
174)main()
{
char a[2];
*a[0]=7;
*a[1]=5;
printf("%d",&a[1]-a)
ANS:
ans may be 1.(illegal initialization)
175)
#include<stdio.h>
main(){
char a[]="hellow";
char *b="hellow";
char c[5]="hellow";
printf("%s %s %s ",a,b,c);
printf(" ",sizeof(a),sizeof(b),sizeof(c));
float value=10.00;
printf("%g %0.2g %0.4g %f",value,value,value,value)
}
(ans is 10,10,10,10.000000)
177)
#include<stdio.h>
void function1;
int i-value=100;
main()
{
i-value=50;
function1;
printf("i-value in the function=",i-value);
printf("i-value after the function=",i-value);
}
printf("i-value at the end of main=",i-value);
functioni()
i-value=25;
178)
main()
{
funct(int n);
{
switch(n)
case1:
m=2;
break;
case2:
m=5;
break;
case3:
m=7;
break;
default:
m=0;
}
THIS IS ROUGH IDEA:
(ANS:Out put is m=0)
179) 2.Java is
a. compiled
b. interpreted.
c. OOP
d. mutithreaded.
e. all
ans e.
181) n=7623
{
temp=n/10;
result=temp*10+ result;
n=n/10
}
Ans : 3267
Ans: b
192)main()
{char a[10]={1,2,3,4,5,6};int x;
for(x=0;x<4;x++){ b[x]=x+'a';}
printf("%s",b);} Ans:abcd56
200)class X{
public:X(){ cout<<"This is Base";}
};
class Y:public X
{ public:Y(){cout<<"This is Derived";}};
what is printed when an object of Y is created?
201)
main()
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n",x,y);
}
202)
int x;
main()
{
int x=0;
{
int x=10;
x++;
change_value(x);
x++;
Modify_value();
printf("First output: %d\n",x);
}
x++;
change_value(x);
printf("Second Output : %d\n",x);
Modify_value();
printf("Third Output : %d\n",x);
}
Modify_value()
{
change_value()
{
return(x+=1);
}
203)
main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
}
204)
main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
205)
main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
206)
#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main()
{
int x=5,y=10;
swap1(x,y);
printf("%d %d\n",x,y);
swap2(x,y);
printf("%d %d\n",x,y);
}
207)
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
208)
209)
#include<stdio.h>
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}
210)
#include<stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
211)
enum day = { jan = 1 ,feb=4, april, may}
what is the value of may?
a)4 b)5 c)6 d)11
e)none of the above
212)
main
{
int x,j,k;
j=k=6;x=2; ans x=1
x=j*k;
printf("%d", x);
212)
fn f(x)
{ if(x<=0)
return; ans fn(5) ....?
else f(x-1)+x;
}
213)
i=20,k=0;
214)
int i =10
main()
{
int i =20,n;
for(n=0;n<=i;)
{
int i=10
i++;
}
printf("%d", i); ans i=20
215)
int x=5;
y= x&y
( MULTIPLE CHOICE QS)
ans : c
216)
Y=10;
if( Y++>9 && Y++!=10 && Y++>10)
printf("........ Y);
else printf("".... )
ans : 13
217)
f=(x>y)?x:y
a) f points to max of x and y
b) f points to min of x and y
c)error
d) ........
ans : a
219)
which of the function operator cannot be over loaded
a) <=
b)?:
c)==
ans: b and d
220) 2)#include<iostream.h>
main()
{
printf("Hello World");
}
the program prints Hello World without changing main() the o/p should
be
intialisation
Hello World
Desruct
the changes should be
a)iostream operator<<(iostream os, char*s)
os<<'intialisation'<<(Hello World)<<Destruct
b) c) d)none of the above
226)struct {
int x;
int y;
}abc;
you can not access x by the following
1)abc-->x;
2)abc[0]-->x;
abc.x;
(abc)-->x;
a)1,2,3
b)2&3
c)1&2
d)1,3,4
234) if a row daminated two dimentional arry in the following which one is advantage
and why?
a) for(i=0;i<1000;i++)
for(j=0;j<1000;j++)
temp=temp+a[i][j];
b) for(j=0;j<1000;j++)
for(i=0;i<1000;i++)
temp=temp+a[i][j]
char *t;
t=x;
x=y;
y=t;
printf("-(%s, %s)",x,y);
}
void swap (char *x,char *y)
{
char *t;
y=x;
x=y;
y=t;
}
a).(New,Dictionary)-(New,Dictionary)
b).(Dictionary,New)-(New,Dictionary)
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
e) not same, MAXINT, MAXUNIT
Ans) a
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
255) how does the C compiler interpret the following two statements
p=p+x;
q=q+y;
a.p=p+x;
q=q+y
a.int
b.char
c.string
d.float
264) a=0;
while(a<5)
printf("%d\n",a++);
how many times does the loop occurs?
a.infinite
b.5
c.4
d.6
271)
# define prod(a,b)=a*b
main()
{
int x=2;
int y=3;
printf("%d",prod(x+2,y-10)); }
float n8;
} TUDAT;
279) CHAR A[10][15] AND INT B[10][15] IS DEFINED
WHAT'S THE ADDRESS OF A[3][4] AND B[3][4]
IF ADDRESS OD A IS OX1000 AND B IS 0X2000
main()
{
int i;
printf("\n %d",i);
f(&i);
printf("\n %d",i);
}
1.10,5
2,10,10
c.5,5
d. none
6.
void f(int i)
{
int j;
for (j=0;j<16;j++)
{
if (i & (0x8000>>j))
printf("1");
else
printf("0");
}
}
what's the purpose of the program
282)
#define f(a,b) a+b
#define g(a,b) a*b
main()
{
int m;
m=2*f(3,g(4,5));
printf("\n m is %d",m);
}
283)
main()
{
284)
char a[5]="hello"
a. in array we can't do the operation .
b. size of a is too large
c. size of a is too small
d. nothing wrong with it .
union b
{
char a;
int b;
int c;
};
which is correct .
a. size of a is always diff. form size of b.(ans.)
290)number(int i)
{
number++;
printf("%d\n",number);
}
main()
{
static int i=0;
number(i);
}
Ans: I don't know
291) main()
{
unsigned char i;
int sum;
main()
{
int i=10;
printf("i=%d\n", i);
fn(&i);
printf("i=%d\n", i);
}
Ans : i=10 i=10
294) main()
{
int a[10] = {1, 2, 3, ...., 10}, i, x=10, temp;
Code 1 :
for(j=0; j<V_L_I; j++)
for(i=0; i<V_L_I; i++)
array[i][j] = 1;
Ans : Code 2
297) main()
{
int i = 1;
fork();
fork();
printf("\ni = %d\n", i+1);
}
Ans : 4 printfs will occur and i = 2
300)for(i=1;i<10;++i,printf("%d",i));+-
ANS:compiling error.
char *string;
string=malloc(5*sizeof(char));
strcpy(string,"hello");
printf("%s",string); /* func to print */
302) in a system integer takes 3bytes and char takes 1byte .......
struct smthing{
int a;
char b[4];
};
310) for program segament given bellow, which of the follwing are true?
program main(output)
type link = ^data
data = record
d : record
n : link
end;
var ptr : link;
begin
new(ptr);
ptr :=nil;
ptr ^.d :=5.2
written(ptr);
end;
a) the programme leads to compile time error
b) " " run " "
c) the programme produces error relating to nil pointer dereferencing
e) both b and a
311) what is the output of the program segament belowif the compiler operates
call byreference?
procedure CALC(P,Q,R);
begin
Q:=Q-1.0
R:=Q+P
end;
begin{main}
A:=2.5; B:=9.0;
CALC(B-A,A,A);
print(A);
end; {main}
a) 1.5
b) 2.5
c) 10.5
313) What will be the value of x and y after execution of the follwing
statment ( C language)
n== 5; x = n++; y = --x;
a) 5,4
b) 6,5
c) 6,6
* d) 5,5
327)o/p=?
int i;
i=1;
i=i+2*i++;
printf(%d,i);
ans: 4
329)#include<malloc.h>
char *f()
{char *s=malloc(8);
strcpy(s,"goodbye")}
main()
{
char *f();
printf("%c",*f()='A');
o/p=?
332)
what is o/p
#include<stdarg.h>
show(int t,va_list ptr1)
{
int a,x,i;
a=va_arg(ptr1,int)
printf("\n %d",a)
}
display(char)
{int x;
listptr;
va_star(otr,s);
n=va_arg(ptr,int);
show(x,ptr);
}
main()
{
display("hello",4,12,13,14,44);
}
a) 13 b) 12 c) 44 d) 14
333)
main()
{
printf("hello");
fork();
}
ans:
334)
main()
{
int i = 10;
printf(" %d %d %d \n", ++i, i++, ++i);
}
ans:
335)
#include<stdio.h>
main()
{
int *p, *c, i;
i = 5;
p = (int*) (malloc(sizeof(i)));
printf("\n%d",*p);
*p = 10;
printf("\n%d %d",i,*p);
c = (int*) calloc(2);
printf("\n%d\n",*c);
}
ans:
336)
337)
#include <stdio.h>
main()
{
enum _tag{ left=10, right, front=100, back};
printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back);
}
ans:
338)
main()
{
int a=10,b=20;
a>=5?b=100:b=200;
printf("%d\n",b);
}
ans:
339)
#define PRINT(int) printf("int = %d ",int)
main()
{
int x,y,z;
x=03;y=02;z=01;
PRINT(x^x);
z<<=3;PRINT(x);
y>>=3;PRINT(y);
}
ans:
340)
#include<stdio.h>
main()
{
char s[] = "Bouquets and Brickbats";
printf("\n%c, ",*(&s[2]));
printf("%s, ",s+5);
printf("\n%s",s);
printf("\n%c",*(s+2));
}
ans:
341)
main()
{
printf("%s\n",(*p)->str);
printf("%s\n",(++*p)->str);
printf("%s\n",((*p)++)->str);
}
ans:
342)
main()
{
char *p = "hello world!";
p[0] = 'H';
printf("%s",p);
}
ans:
343)m=3 while (m<18) do {m=m+2;m=m-1}
ans:15
347)a=2;b=1;x=1;while(x<=4)do {a=a+b;x=x+1}
ans:(5,1)34*)
349)a=0;b=0;x=1;while (x<=4){a=a+x;b=b-x;x=x+1;}
ans:(10,-10)
}
This won't go into the loop as TRUE is defined as
6) A choclate of size nXn is given and is to be made into pices of size 1x1. At a time both
horizontal and a vertical cut is done. Find the order of complexity
a) 0(n2)
b) o(nlogn)
c) o(logn)
Ans : a
HUGHES
13) how many null pointer are there in N number binary tree
ans:N+1
14) Two sorted list of size n what are the maximum comparison in merge
ANs:2n-1
16)if there are n nodes in a binary tree, how many null pointers are
there
ans:n+1;
24) For a binary tree with n nodes, How many nodes are there which
has got both a parent and a child?
25) Bubble sort : Given sequence of numbers what will be order of sequences
after two iterations.
Ans: very trivial, but you should know what bubble sort
does.
26)Bubble sort : how many swap operations has been done in the above
process?
27)What data structures you should use for dictionary searching and it
should be capable of doing spell check also ?
Ans: Hashing
36)in binary search tree which traversal is used for getting ascending
order values (inorder )
37) fun(n)
{
if(n<=2)
return (1);
else
return ((fun(n-1)*fun(n-2));
}
find the order of complexity of the programme.
possible answer ---- N(2^n)
41) A search procedure which assosiates an address with a key value and
provides a mechanism for dealing with two or more values assigned to the
same address to the same address is called.
a) linear earch
b) binary search
* c) hash coded search
d) radix search
48) given a height balanced tree. If we add one more node , how
many nodes gets unbalanced ? Ans. 3
52) A choclate of size nXn is given and is to be made into pices of size 1x1. At a time
both horizontal and a vertical cut is done. Find the order of complexity
a) 0(n2)
b) o(nlogn)
c) o(logn)
Ans : a
8. Frequency spectrums for AM, FM and PM (figure given, u'veto tell which
Kind of modulation it belongs to)
10. LSB of a shift register is connected to its MSB, what is formed: Ans:
RING Counter
11. 2-3 Qns based on Demorgan's laws (identiies: (A+b)' = A'b', etc)
13 Qn on pipeline architecture
-11-
1--1
1--1
-11-
karnaugh map
23) CPU have one interrupt pin and on to connect with external
devices with some priority?
which type of the following is used?
a. parallel priority interrupt
b. daisy chain
c. RS filpflop
d.
INTERGA
25) If a CPU has 20 address lines but MMU does'nt use two of them.
OS occupies 20K. No virtual memory is supported. What is the
maximum memory available for a user program
26) Using the following instructions and two registers , A&B.
30) If a channel has 2400 bauds what is the data rate it support.
check in data commn book stalins
Ans : b
37) In a compiler there is 36 bit for a word and to store a character 8bits are needed. IN
this to store
a character two words are appended .Then for storing a K characters string, How many
words are needed.
[a] 2k/9 [b] (2k+8)/9 [c] (k+8)/9 [d] 2*(k+8)/9 [e] none
39) k-map
ab
----------
c 1 x 0 0
1 x 0 x
solve it
a. A.B
B. ~A
C. ~B
D. A+B
B=C
42) 1.A logic ckt is given and asked to identify the configuration.
ANS: XOR.
44) 4 stage ripple counter with delay(f/f) 10msec. How much time it takes
for a state to change.
ANS:4*10=40.
49) two progs are given. one satrts counting frm 0 to MAX and the other
stars frm MAX to 0. which one executes fast.
ANS:may be Max to 0.Think of it.
53) EE-ROM is
* a) electricity erasable
b) easily "
c) non "
d) effective "
55) 1.A logic ckt is given and asked to identify the configuration.
ANS: XOR.
57)4 stage ripple counter with delay(f/f) 10msec. How much time it takes
for a state to change.
ANS:4*10=40.
62) two progs are given. one satrts counting frm 0 to MAX and the other
stars frm MAX to 0. which one executes fast.
ANS:may be Max to 0.Think of it.
Automata:
1.what m/c is used to recognize context free grammar ? Ans. pushdown automata
2. Which type of grammar can be recognized by finite state m/c Ans. right linear
grammar.
3)What is a finite Automata.
4)what is a turing machine.
Network
1.In OSI, terminal emulation is done in (HCL)
a)semion b)appl.. c)presenta... d)transport
ans: b
11 Checksum in IP packet is
Sum of the bits and 9's complement of sum
18) ARP
a) MAC to IP
b) IP to MAC
c)
Ans : b
19) NSF
33)What are the funs. of transport layer? What is TCP, UDP, their
differences .....
BFL
50) FDDI is a
* a) ring network
b) star network
c) mesh network
d) bus based network
Software Engineering
HONEYWELL
Reasoning
1) m has double amount as d, y has rs. 3 more than half of amount of d
the ordering a,b,c mcdcy
ans:data insufficient d c m c y
3) p,q,r,s,t,u -securing grant;two tourist parties and then two security gaurds should go
with each party
p and r-are enemies, q does not go south
p&s-are willing to be together
4) if a car starts from a towards b with some velocity due to some problem in the engine
after travelling 30km.if the car goes with 4/5 th of its actuval velocity the car reaches b
45min later to the actual time. If the car engine fails ofter travelling 45km, the car
reaches the destination b 36min late to the actual time , what is the initial velocity of car
and what is the distance between a and b in km
Ans) 20 & 130.
5)the values of shares a,b and c from january to june are as follows.
Month a b c
Jan 30 60 80
Feb 35 65 85
Mar 45 75 65
Apr 40 75 82
May 55 75 85
June 50 75 80
Iii) if cobal is in the 2nd month and bino in 6th month are there in
Addition to the above condition, fortran will be in which month.
8. A square plot of some size , at four corners equal squares of some size
Are cut and is formed as open box. If this open box carries 128ml of oil.
What is the size of the plate i.e. Side
A.17 b.14 c.13
9. In a square , all the mid points are joined. The inner square is
Shaded. If the area of the square is a, what is the shaded area?
10. Two questions on basic angles i.e given a circle, a few chords or
Diameter is drawn etc.
ii)
13. By using the data given below answer the following questions.
Male 20
Female 80
Total 60
some thing similar to that question.
15)a hotel has two,the east wing and the west wing.some east wing rooms
But not all have an ocean view(ov).all ww have a harbour view(hv).the
Charge for all rooms is identical, except as follows
* extra charge for all hv rooms on or above the 3rd floor
* extra charge for all ov rooms except those without balcony
* extra charge for some hv rooms on the first two floor&some ew rooms
Without ov but having kitchen facilities. (gre modrl test 3-question
1j-22)
16)post man has a data of name surname door no.pet name of 4 families.
But only one is correct for each family.there are a set of statements
&questions.
lucent
i. F & g
ii. E and h
iii. D
(a) i only (b) ii only (c) iii only (d) i,ii, & iii
(e) i & ii (or) ii & iii but not both ans: (e)
(ans: 240
(ans: 8)
(ans: 6)
(ans: 5)
(ans: 30)
32) the square is cut such that the end point of one side is
shown in fig.. This is repeated two times, what is the area ??
(ans: 3.61)
34) two motor cycles a & b are started from one point at
4 kmph & 6 kmph; after 45 min b starts returning , at what
time they will reach....
(ans: c)
Kya kya is an island in the south pacifi . The inhabitants of kya kya
Always answer any question with two sentences, one or which is always
True and other is always false.
36) you are walking on the road and come to a fork. You ask ,the inhabitants
Ram.laxman, and lila as" which road will take me to the vilage?
37) you find that your boat is stollen. U questioned three inhabitants ot islands and their
replies are
38) you want to speak to the chief of village , u ask three fellows amar
Bobby, charles and bobby is wearing red shirt
Amar : iam not bobby`s son ; the chief wears red shirt
Bobby : iam amars father ; charles is the chief
Charles : the chief is one among us; iam the chief
39) there is only opne polot in the village(island). You interviewed threem man
Koisk ,lorry and mishra
U also notice that koisk is wearing cap.
M says : larry is father in the pilot .larry is not the priests son
Koisk : iam the priest on theis island only prists can wear the caps
Larry : iam the priest son . Koisk is not the prest
Numeric Ability
1.given 100 to 999 nos. Probability of picking a no. with out
digit 7. Ans. 18/25.
5. In A,B,C are having some marbles with each of them. A has giben B and C the same
number of marbles they already have to each of them. then, B gave C and A the same no.
of marbles they have, then C gave A and B the same no. of marbles they have. At the
end A,B,and C have equal no. of marbles.
(i) If x,y,z are the marbles initially with A,B,C respectively.
then the no of marbles B have at the end
(a) 2(x-y-z) (b) 4(x-y-z) etc.
(ii)If the total no. of marbles are 72, then the no. of marbles
with A at the starting
a. 20 b. 30 c. 32
6) person has Rs 100/- in his pocket, he can as 25 pencils or 15books.
He kept 15% of the money for travelling expenses and purchased 5
ncils.So how many books he can purchase with the remaining money.
A boy multiplied a number with 10 and got 100,insted of
dividing it . If he devided it what would be the answer?
(Ans is 1)
15)In a certain company 20% of the men and 40% of the women
attended the annual company picnic.If 35% of all the emplo-
yees are men .What % of all the employee went to the picnic?
(Ans is 33%)
18)In a computer tape library there are two racks with 40 tapes
per rack.In a given day 30 tapes are in use . What fraction
remains in the rack?
(Ans is 5/8)
19)In 1978, a kg of paper was sold at Rs25/-. I f the paper rate increases at 1.5% more
than inflation rate which is of 6.5% a year , then what wil be the cost of a kg of paper
after 2 years?
a)29.12 (b) 29.72 (c) 30.12 (d) 32.65 (e) none of these
20)In A,B,C are having some marbles with each of them. A has giben B and C the same
number of marbles they already have to each of them. then, B gave C and A the same no.
of marbles they have, then C gave A and B the same no. of marbles they have. At the end
A,B,and C have equal no. of marbles.
(i) If x,y,z are the marbles initially with A,B,C respectively.
then the no of marbles B have at the end
(a) 2(x-y-z) (b) 4(x-y-z) etc.
(ii)If the total no. of marbles are 72, then the no. of marbles
with A at the starting
a. 20 b. 30 c. 32
21)If a car starts from A towards B with some velocity due to some problem in the engine
after travelling 30km.If the car goes with 4/5 th of its actuval velocity the car reaches B
45min later to the actual time. If the car engine fails ofter travelling 45km, the car reaches
the destination B 36min late to the actual time , what is the initial velocity of car and
what is the distance between A and B in km
ans) 20 & 130.
22)A person has Rs 100/- in his pocket, he can as 25 pencils or 15books.He kept 15% of
the money for travelling expenses and purchased 5 PEncils.So how many books he can
purchase with the remaining money.
23) The values of shares A,B and C from january to june are as follows.
month A B C
JAN 30 60 80
FEB 35 65 85
MAR 45 75 65
APR 40 75 82
25)In a class , except 18 all are above 50 years. 15 are below 50 years ofage. how many
people are there
a) 30 b) 33 c) 36 d) none of these.
26)A square plot of some size , at four corners equal squares of some size are cut and is
formed as open box. If this open box carries 128ml of oil.
28) In a square , all the mid points are joined. the inner square is
shaded. If the area of the square is A, what is the shaded area?
29)11. two questions on basic angles i.e given a circle, a few chords or diameter is drawn
etc.
40)In a certain company 20% of the men and 40% of the women
attended the annual company picnic.If 35% of all the emplo-
yees are men .What % of all the employee went to the picnic?
(Ans is 33%)
43)In a computer tape library there are two racks with 40 tapes
per rack.In a given day 30 tapes are in use . What fraction
remains in the rack?
(Ans is 5/8)
45) 1 2 3 4
+3455
----------
4689
-2345
----------
2344
+1254
------------
3698
Q) Strike off any digit from each number in seven rows (need not
be at same place) and combine the same operations with 3 digit numbers
to get the same addition. After this strike off another digit from all
and add all the No.s to get the same 2 digit No. perform the same
process again with 1 digit No.s. Give the ' no.s in 7 rows at
each stage.
46) there is a safe with a 5 digit No. The 4th digit is 4 greater than
second digit, while 3rd digit is 3 less than 2nd digit. The 1st digit
is thrice the last digit. There are 3 pairs whose sum is 11. Find
the number. Ans) 65292.
47) there are 2 guards Bal and Pal walking on the side of a wall of a
48) xxx)xxxxx(xxx
3xx
-------
xxx
x3x
------
xxx
3xx
------
Q) Find the 5 digit No.
Hint: 5 is used atleast once in the calculation.
49) Afly is there 1 feet below the ceiling right across a wall length
is 30m at equal distance from both the ends. There is a spider 1 feet
above floor right across the long wall eqidistant from both the ends.
If the width of the room is 12m and 12m, what distance is to be
travelled by the spider to catch the fly? if it takes the shortest
path.
50) Ramesh sit around a round table with some other men. He has one
rupee more than his right person and this person in turn has 1 rupee
more than the person to his right and so on, Ramesh decided to give
1 rupee to his right & he in turn 2 rupees to his right and 3 rupees
to his right & so on. This process went on till a person has
'no money' to give to his right. At this time he has 4 times the
money to his right person. How many men are there along with Ramesh
and what is the money with poorest fellow.
54) THERE WERE 750 PEOPLE WHEN THE FIRST SONG WAS SUNG. AFTER
EACH
SONG 50 PEOPLE ARE LEAVING THE HALL. HOWMANY SONGS ARE SUNG
TO MAKE
THEM ZERO?
ANS:16
56) HOWMANY ZEROS ARE THERE IN THE PRODUCT OF THE INTEGER FROM
1TO 100?
1 TO 10 -2 ZEROS
21 TO 30 -3 ZEROS : BECAUSE 25 = 5*5
22 *5
24 *5
ANS:6000
ANS: 86
ANS:25 MIN
ANS: 25%
ANS: 30
65) in some game 139 members have participated every time one fellow will
get bye what is the number of matches to choose the champion to be
held?
72)in a company 30% are supervisors and 40% employees are male
if 60% of supervisors are male. what is the probability
that a randomly choosen employee is a male or female?
73)statement: all green are blue are blue, all blue are white
conclusion:
I) some blue are green II) some white are green
III)some green are not white IV) all white are blue
a) he has given four choices like gre type
APTITUDE TEST
75)33 1/3 of 101 + 296 is
(ans 1200) check
79)2020201-565656=?
(ans 1454545)
80)CHAIRS PROBLEM
5 chairs=9 tables,12 tables = 7 stools likethat- - -
(ans is 80Rs)
82)One watch is showing 30 past 3 .What is the angle between minutes &
hours hand?
(ans 75 degrees)
85)One ball was dropped from 8ft height and every time it goes half
of the height. How much distance it will travell before coming to
rest.
(ans 24 approximately)
87).6*12*15 is the volume of some material.How many cubes can be inserted into that?
Ans.40
90)Cost of an item is x. It's value increases by p% and decreases by p%Now the new
value
is 1 rupee, what is the actual value.
Ans.(1000)/(1000-p*p).
91)A right circular cylinder and a cone are there.Base radius of cone is equal to radius
of cylinder.What is the ratio of height to slant side.
92)Distance between two poles is 50 meters.A train goes by 48 kmph in one minute.How
many
poles will be crossed by the train.
93)A pole seen from a certain distance at an angle of 15 degrees and 100 meters ahead by
30 degrees. What is th height of pole.
94)15 people--each has to pay Rs.20.. 20 people--each has to pay Rs.18.. for 40 people--
how
much has to pay ?
95)if p=2q then q=r*r,if p-odd then q is even,whether we decide r is even or odd ?
choices:a)first condition is sufficient
b)second condition is sufficient
c)both are sufficient
d)both are not sufficient
97)If he sells 40 magoes, he will get the selling price of 4 mangoes extra, What is his %
increse in profit ?
98)100 glasses are there. A servant has to supply glasses to a person If he supplies the
glasses without any damage he will et 3 paise otherwise he will loose 3 paise.At the
end of supplying 100 glasses if he gets 270 paise, how many glasses were supplied
safely.
Ans: 95
99) distance D=rt where r & t are +ve and r is constant,as t increses then
D_________
103)consider expresion 'ab' . what happens when 'a' is divided by 'c' &
'b' is
multiplied by 'c'.
ans:value remains same.
ans:144
ans: c
107)to travel 'm' miles the time is 'h' hours,then what is the time taken
to
ans:M*h/m
108) a sum 's' is devided into 4 parts.second person gets Rs 10 more than
first.3rd person is Rs 10 more than second, 4th is 10 more than 3rd.
how much amount do 1st person get.
ans;(s-60)/4
109) fridge cost R Rs,cover value is 5,discount d% then its new cost
ans:R-R*d/100-5(1-d/100)