Вы находитесь на странице: 1из 13

Hi

Make a test paper for (Pursuing candidates BTech 3rd and 4th year) based on
Topic No of questions(Objective)
1 C 10
2 C++ 5
3 OS 5
4 DS 5
5 Computer
Fundaments 5
6 Aptitude 10
Total no of pages for print not more than 3- 4 .
Do it before 5 pm ,inform irshad sir to take print of 100 copies .

main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Answer:
mmmm
aaaa
nnnn

main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
Answer:
5 4 3 2 1

main()
{
extern int i;
i=20;
printf("%d",i);
}
Answer:
Linker Error : Undefined symbol '_i'

main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
Answer:
I hate U

class base
{
public:
int bval;
base(){ bval=0;}
};
class deri:public base
{
public:
int dval;
deri(){ dval=1;}
};
void SomeFunc(base *arr,int size)
{
for(int i=0; i size; i++,arr++)
cout«arr- bval;
cout«endl;
}
int main()
{
base BaseArr[5];
SomeFunc(BaseArr,5);
deri DeriArr[5];
SomeFunc(DeriArr,5);
}
Answer:
00000
01010
Explanation:
The function SomeFunc expects two arguments.The first one is a pointer to an arr
ay of base class objects and the second one is the sizeof the array.The first ca
ll of someFunc calls it with an array of bae objects, so it works correctly and
prints the bval of all the objects. When Somefunc is called the second time the
argument passed is the pointeer to an array of derived class objects and not the
array of base class objects. But that is what the function expects to be sent.
So the derived class pointer is promoted to base class pointer and the address i
s sent to the function. SomeFunc() knows nothing about this and just treats the
pointer as an array of base class objects. So when arr++ is met, the size of bas
e class object is taken into consideration and is incremented by sizeof(int) byt
es for bval (the deri class objects have bval and dval as members and so is of s
ize = sizeof(int)+sizeof(int) ).

class base
{
public:
void baseFun(){ cout«"from base"«endl;}
};
class deri:public base
{
public:
void baseFun(){ cout« "from derived"«endl;}
};
void SomeFunc(base *baseObj)
{
baseObj->baseFun();
}
int main()
{
base baseObject;
SomeFunc(&baseObject);
deri deriObject;
SomeFunc(&deriObject);
}
Answer:
from base
from base
Explanation:
As we have seen in the previous case, SomeFunc expects a pointer to a base class
. Since a pointer to a derived class object is passed, it treats the argument on
ly as a base class pointer and the corresponding base function is called.

class opOverload{
public:
bool operator==(opOverload temp);
};
bool opOverload::operator==(opOverload temp){
if(*this == temp ){
cout«"The both are same objects\n";
return true;
}
else{
cout«"The both are different\n";
return false;
}
}
void main(){
opOverload a1, a2;
a1= =a2;
}
Answer :
Runtime Error: Stack Overflow
Explanation:
Just like normal functions, operator functions can be called recursively. This p
rogram just illustrates that point, by calling the operator == function recursiv
ely, leading to an infinite loop.

class some{
public:
~some()
{
cout«"some's destructor"«endl;
}
};
void main()
{
some s;
s.~some();
}
Answer :
some's destructor
some's destructor
Explanation:
Destructors can be called explicitly. Here 's.~some()' explicitly calls the dest
ructor of 's'. When main() returns, destructor of s is called again, hence the r
esult.

In C++ a function contained with in a class is called


a member function an operator a class function a method
____ transforms one interface into another interface
Program
Software
Data
None
ans software

Multiprogramming systems
Are easier to develop than single programming systems
Execute each job faster
Execute more jobs in the same time period
Are used only one large mainframe computers.
ans
Execute more jobs in the same time period

Swapping
Works best with may many small partitions
Allows many programs to use memory simultaneously
Allows each program in turn to use the memory
Does not work with overlaying
ans
Allows each program in turn to use the memory

Page stealing
Is a sign of an efficient system
Is taking page frames from other working sets
Should be the tuning goal
Is taking larger disk spaces for pages paged out

ans
Is taking page frames from other working sets

Which of the following program is not a utility?


Debugger
Editor
Spooler
All of the above
ans Spooler\]

DS

When inorder traversing a tree resulted E A C K F H D B G; the preorder traversa


l would return
a. FAEKCDBHG
b. FAEKCDHGB
c. EAFKHDCBG
d. FEAKDCHBG

ans b. FAEKCDHGB

A data structure where elements can be added or removed at either end but not in
the middle
a. Linked lists
b. Stacks
c. Queues
d. Deque

ans Deque

Which of the following name does not relate to stacks?


a. FIFO lists
b. LIFO list
c. Piles
d. Push-down lists

ans FIFO

Which of the following is two way list?


a. grounded header list
b. circular header list
c. linked list with header and trailer nodes
d. none of above
ans none of the above
Binary search algorithm can not be applied to
a. sorted linked list
b. sorted binary trees
c. sorted linear array
d. pointer array
ans sorted link list

COmputer fundamentals
CD-ROM stands for
a. Compactable Read Only Memory
b. Compact Data Read Only Memory
c. Compactable Disk Read Only Memory
d. Compact Disk Read Only Memory

ans d. Compact Disk Read Only Memory

The data recording format in most of the modern magnetic tape is


a. 7-bit ASCII
b. 7-bit EBCDIC
c. 8-bit ASCII
d. 8-bit EBCDIC

ans d. 8-bit EBCDIC

Which language is directly understood by the computer without translation progra


m?
a. Machine language
b. Assembly language
c. High level language
d. None of above
ans a MAchine language
Which statement is valid?
a. 1KB = 1024 bytes
b. 1 MB=2048 bytes
c. 1 MB = 1000 kilobytes
d. 1 KB = 1000 bytes
ans a 1KB = 1024 bytes

Seek time is
a. time to position the head over proper track
b. time to position the head over proper sector
c. time to position the head over proper cylinder
d. none of above
ans a. time to position the head over proper track

APTITUDE
8 men and 10 women can do a work in 25 days,the same work can be done by 10 chil
dren and 5 women.In how many days can 2 children and 3 men do the same work.
8men and 10 womanmeans 8x and 10 yso 8x+10y 25 days.......(1eq)
also10x+5y 25 days.......(2 eq)equating(subracting)..
we get ..2x-5y 0 daysthat means....x/y 5/2x 5 and y 2so now ...
we want to know the work done by 2 children and 3 menie....
2x+3y 2*5+3*2 10+6 16so work done is 16 days..ANS: 16 days

After 10 years A will be twice the age of B before 10 years and now if the diffe
rence is 9 years between them then what is the age of B after 10 years
ans 49 years
Find next number in the series 105, 85, 60, 30, 0, -45, -90,_?
Answer:
Answer: 0
Explanation:
105-20=85; 85-25=60; 60-30=30; 30-35=-5; -5-40=-45; -45-45=-90;

A man can row at 5 kmph in still water. If the velocity of current is 1 kmph and
it takes him 1 hour to row to a place and come back, how far is the place?
2 km
2.4 km
3 km
2.6 km
ans
Speed downstream = (5 + 1) kmph = 6 kmph.
Speed upstream = (5 - 1) kmph = 4 kmph.
Let the required distance be x km.
Then, x/6 + x/4 = 1
2x + 3x = 12
5x = 12
x = 2.4 km.

A man rows to a place 48 km distant and come back in 14 hours. He finds that he
can row 4 km with the stream in the same time as 3 km against the stream. The ra
te of the stream is:
1 km/hr
1.5 km/hr
2 km/hr
2.5 km/hr

ans
Suppose he move 4 km downstream in x hours. Then,
Speed downstream = 4/x km/hr.
Speed upstream = 3/x km/hr.
48/(4/x) + 48/(3/x) = 14 or x = 1/2 .
So, Speed downstream = 8 km/hr, Speed upstream = 6 km/hr.
Rate of the stream = (1/2)*(8 - 6) km/hr = 1 km/hr.

A boat running downstream covers a distance of 16 km in 2 hours while for coveri


ng the same distance upstream, it takes 4 hours. What is the speed of the boat i
n still water?
8 kmph
4 kmph
6 kmph
7 kmph

Rate downstream = 16/2 kmph = 8 kmph.


Rate upstream = 16/4 kmph = 4 kmph.
Speed in still water = 1/2 *(8 + 4) kmph = 6 kmph.

A clock is started at noon. By 10 minutes past 5, the hour hand has turned throu
gh:
145 degree
150 degree
155 degree
160 degree
Angle traced by hour hand in 12 hrs = 360 degree.
Angle traced by hour hand in 5 hrs 10 min.
i.e.,31/6 hrs = ((360 /12)x (31 /6)) = 155 degree
In how many different ways can the letters of the word 'OPTICAL' be arranged so
that the vowels always come together?
4320
720
120
2160
The word 'OPTICAL' contains 7 different letters.
When the vowels OIA are always together, they can be supposed to form one letter
.
Then, we have to arrange the letters PTCL (OIA).
Now, 5 letters can be arranged in 5! = 120 ways.
The vowels (OIA) can be arranged among themselves in 3! = 6 ways.
Required number of ways = (120 x 6) = 720.

In a car there are 6 people.Each one carry 6 bags. Each bag contains 6 cat.Each
cat carry 6 small cats. How many legs are there in the car?
Answer:
The answer is 6060.
Total legs of Man = 6*2 = 12
Total Legs of Cats = 6*6*6*4 = 864
Total legs of Small Cats = 6*6*6*6*4 = 5184
A light flashes every 10 seconds, how many times will it flash in 3/4 of an
hour?
Answer:
271 Times.
Explanation:
In 3/4 of an hour there are (60 * 3/4) minutes = 45 minutes.
In 45 minutes there are (60 * 45) seconds = 2700 seconds.
As light flashed for every 10 seconds.
In 2700 seconds 2700/10 = 270 times.
The count start after the first flash, the light will flashes 271 times in 3/4
of an hour.

Вам также может понравиться