Question(1-2) Based on the given code
class A
{ public:
A() {
cout<<”howzhat”; }
~A(){
cout<<”whatizit”; }
};
class B:A
{ public:
B(){
cout<<”bibek”; }
~B(){
cout<<”gupta”; }
};
1. main() {
B x;
Cout<<”done”;}
a)prints howzhat bibek done gupta whatizit
b)prints nothing
c)print gupta whatizit done howzhat bibek
d)none of the above
2.if the main has the two statement :
main() {
{ B x;
Cout<<”done”; } }
The output will be--------------------------------------------------
Q3. 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<<”\t”; }
int main(){
base BaseArr[5];
SomeFunc(BaseArr,5);
deri DeriArr[5];
SomeFunc(DeriArr,5);
}
Find the output?
Q4. The postfix equivalent of the prefix * + a b – c d is
(a)ab+cd-* (b)abcd+-* (c)ab+cd*- (d)ab+-cd*
Q5. Which of the following is useful in traversing a given graph by breadth first
search?
(a)stack (b)set (c)list (d)queue
Q6. Consider the following program segments:
d=0;
for(i=1;i<31;++i)
for(j=1;j<31;++j)
for(k=1;k<31;++k)
if(((i+j+k)%3)==0)
d=d+1;
printf(“%d”,d);
the output wil be
a)9000 b)27000 c)3000 d)18000
Q7. The number of addition performed by the above (question 6)program
fragment
(a)27000 (b)27000*3 (c)9000+3*27000 (d)9930+27000*3
Q8. The declaration
Enum cities {Bethlehem,Jericho,Nazareth=1,Jerusalem}
Assigns value 1 to
(a)Bethlehem (b)Nazareth (c)Bethlehem& Nazareth (d)jericho&Nazareth
Q9. Consider the program segment:
j=2;
while((i%j) !=0)
j=j+1;
if(j<i) printf(“%d”,j);
if i>=2 then the value of j,will be printed only if
(a)if i is prime (b)j doesnot divide i (c)j is odd (d) i is not prime
Q10. Consider the following program segment:
Char *a,*b,c[10],d[10];
a=b; b=c; c=d; d=a;
choose the statement having error:
(a)no error (b)a=b: and b=c; (c)c=d; and d=a; (d)a=b; and d=a;
Q11. int main() {
int a=0010;
cout << "R4R:";
cout << a;}
O/P :- _________________________
Q12. main() {
char *s="\123\n";
printf("%d",sizeof(s));
printf("%s",s);}
O/P :- ___________________________
Q13. main() {
char *a,*f();
a=f();
printf("%s",a); }
char *f() {
return("Hello World");}
O/P :- _____________________________
Q14. main() {
int i,j;
for(i=0,j=0;i<5,j<25;i++,j++);
printf("%d %d",i,j);}
O/P :- _______________________________
Q15. Will the following code complie or not
main( ) {
ostream o ;
o << "Dream. Then make it happen!" ; }
________________________________
Q16. int a=1;
int ab=4;
int main() {
int b=3,a=2;
printf("%i*/%i*/%*/i",a,b,ab); }
O/P :- __________________
Q17. What will be the size of file “test.dat” :- (in bytes)
main(){
FILE *fp;
fp=fopen("test.dat","w");
fprintf(fp,"hello\n");
fclose(fp);
fp=fopen ("test.dat","w");
fprintf (fp,"world");
fclose(fp);
}
O/P :- ___________________
Q18. main() {
int a=3,b=2,c=1,k;
//What's the value of k?
k== a< b < c-1; cout<<k; }
O/P :- __________________
Q19. #include<stdio.h>
#include<conio.h> int main(){
for(;NULL;)
printf("cquestionbank"); }
(in turbo c) O/P :- ________________
Q20. I/P :- Sachin Tendulkar is good player.
int main(){
char name[20];
scanf("%[\n]s",name);
printf("%s",name); }
O/P :- ____________________________
Q21. I/P :- Sachin Tendulkar
is
good player.
int main(){
char name[20]="";
scanf("%20[^\t]s",name);
printf("%s",name); }
O/P :- ___________________________________
Q22. int main(){
printf("compu","ter"); }
O/P :- ________________________________
Q23. Here’s a few interesting lines of C. Your question, what is value of b) ?
int a; /* a = 42*/
int b = 0;
while( a ) {
a &= a – 1;
b ++; }
ANS :- _________________
Q24.
main()
{ int l,b; int con;
l=b=2;
con (b==l) ? l : 0;
printf("%d",con);
}
O/P :- ___________________________
Q25. which topology takes minimum wiring :--
O/P :-
Q26. What is the output of following program
char ch=’A;
while(ch<=’F’){
switch(ch){
case ‘A’:case ‘case 'B':case 'C':case 'D':ch++;continue;
case 'E':case 'F':ch++;}
putchar(ch);}
(a) ABCDEFG (b)EFG (c)FG (d)none
Q27. int a=1,b=2,c=3;
int *pointer;
pointer=&c;
a=c/*pointer;
b=c;
printf("a=%d b=%d",a,b);
(a) a=1 b=3 (b) a=3 b=3 (c) a=3 b=2 (d) error
Q28. main(){
int a[]={1,2,3,4,5,6,7};
char ch[] = {‘a’,’x’,’h’,’o’,’k’};
printf("%d\t %d ", (&a[3]-&a[0]),(&c[3]-&c[0])); }
What Will be the output____________________
Q29. fun(int n);
int fun( int n){
int i;
for(i=0;i<=n;i++)
fun(n-i);
printf(" well done");}
howmany times is the printf statement executed for
n=10?_____________________
Q30. int i=20,k=0,j;
for(j=1;j<i;j=1+4*(i/j)) {
k+=j<10?4:3; }
printf("%d", k);
(a) 1 (b) 2 (c) 3 (d) 4
Q31. which of the function operator cannot be over loaded ( More than one answer is
correct
Tick all correct options )
(a) <= (b)?: (c)== (d)*
Q32. main(){
int i=400,j=300;
printf("%d..%d");}
what is the output:______________________
Q33. Which of the following is not an infinite loop ?
(a) while(1)\{ ....}
(b) for(;;){ ... }
(c) x=0;
do{ /*x unaltered within the loop*/ ..... }
while(x = = 0);
(d) # define TRUE 0
...
while(TRUE){ .... }
Q34. Do function declaration get stored in an .EXE file ?? (Y/N) _______________
Q35. Can we initiate on object s of class sample through a statement
sample s = 10,20;
(Y/N)_________________
Q36. In SJF Scheduling what is the average waiting time____________________
Process P1 P2 P3 P4
Burst time 6 8 7 3
Q37. In Priority Scheduling what is the average waiting time________________
Process P1 P2 P3 P4 P5
Burst Time 10 1 2 1 5
Priority 3 1 4 5 2
Q38. Which topology has highest reliability
(a) Star (b) mesh (c) ring (d) bus
Q39. C front is
(a) Front end of a C compiler
(b) Is the preprocessor of a C compiler
(c) Is a tool that translate a C++ code to its equivalent C code
(d) None of the above
Q40. Find 9’s and 10’s complements of the 75 are _______________
Q41-Q44 ( MORE THAN ONE OPTION IS CORRECT - MARK WILL BE AWARDED IF U CORRECTLY TICK
ALL POSSIBLE ANSWERS )
Q41. Which cannot be declared as a static?
(a) class (b) object (c) functions (d) variable
Q42. Concept of lock can be used to solve the problem of
(a) lost update (b) uncommitted dependency (c) none
Q43. Which of the following is used for ensuring ATOMICITY ?
(a) log with deferred modification
(b) log with immediate modification
(c) shadow paging
(d) none
Q44. In PL/SQL
(a) a block can access variables that are declared in the enclosing block
(b) a block can access variables that are declared in the enclosed block
(c) a block cannot access variables that are declared in the enclosing block
(d)a block cannot access variables that are declared in the enclosed block
Q45. Which unicast routing protocol is an implementation of path vector protocol
(a) RIP (b) BGP (c) OSPF (d) none
Q46. Heap and Free Store are same. (Y/N) ________________________
Q47. In IPv4 datagram the minimum size of Header_________________
(Q48 – Q50) Based on the algorithms of mutual exclusion
Algorithm msg per entry/exit delay before entry
Centralized
Distributed
Token ring
Answers:
Techinal Questions Answers:
1.d 2.howzhat bibek done gupta whatizit 3. 00000 01010 4.a 5.d 6.a 7. 8.d 9.d 10.c
11.R4R:8 12.4S 13.Hello World 14. 25 25 15.NO 16.2*/3*//I 17.5 18.garbage 19.cquestionbank
20.NO OUTPUT 21. Sachin Tendulkar 22.compu 23.3 24.error 25.bus 26.c 27.d 28. 3,3 29. never
is
30.d 31.b or d 32.400..300 33.d 34.No 35.No 36.7ms 37.8.2ms 38.b 39.c 40.24,25 41. a,b
42.a,b 43.a,b,c 44.a,d 45.b 46.yes 47.20 bytes 48.3,2 49.2(n-1),2(n-1) 50. 1 to +INF, 0 to n-1
0 comments:
Post a Comment