OOPS
1.Is it possible for a member function of a class to activate another member function of the same class?
no
yes,but only public member functions.
Yes, only private member functions
Yes, both public & private member functions can be activated
2. Can 2 classes contain member functions with the same name?
a. no
b. yes, but only if the 2 classes have the same name
c. yes, but only if the main program does not declare both kinds
d. yes, this is always allowed
3.what is the purpose of template functions?
a. to allow a single function to be used with varying types of arguments
b. to hide the same name of the function from the linker
c. to implement container classe
d. to permit the use of the debugger without the –gstabs flag
4.what kind of functions can access private member variables of a class
a. friend function of a class
b. private member functions of the class
c. public member functions of the class
e. all of the above
f. none
5. what technique is used to step thro’ items of a container class?
a. copy constructor
b. default constructor
c. iterator (ans)
6. what is the term used to describe the situation when a derived class provides a function already provided in the base class ?
a. inheritning
b. overriding
c. abstraction
d. none
7. what r the characteristics of object, in general
a. it has name, properties
b. name, properties, behaviour
c. it can act on receiving a message
d. a &c
e. b&c
8. bundling data members together with the functions is called
a. data hiding
b. encapsulation (ans)
c. data morphism
d. data binding
9.why is OO programming useful?
It supports good s/w engg. Practices
It promotes thinking abt s/w in a way that models the way we think & interact naturally
Supports code reuse
A &b
A,b & c
10. suppose tu want 2 develop 2 diff, + operators that calculate & return an object of the same class. Which stmt is correct?
a. 1 operator must be a frnd & the other must not
b. 1 operator must be public & the other private
c. operators must have different parameter lists
d. it is not possible 2 have 2 different + operators
11.what is inheritance?
a. a relationship in which the structure & functionality of a class (“child ) is defined in terms of the structure & functionality of another(parent)
b. a relationship in which the structure & functionality of a class (“parent” ) is defined in terms of the structure & functionality of another(“child”)
c. a relationship in which the structure & functionality of a class make calls 2 functionalty of another
d. a relationship in which the structure of a class includes 1 or more instances of another
e. all of above
12. what is relationship betn . a class & its public parent class
a. “.is a….”
b. “has a”
c. “is implemented as a ……”
d. uses a
e. becomes a
13. how does inheritance relate 2 abstraction?
A . a base class is an abstraction of all its derived classes
b. a derived class is an abstraction of all its base classes
d. Base & derived classes are abstractions for each other
e. Inheritance prevents abstration
f. No relationship betn them
14. why can’t compiler “hard-code” direct calls to virtual functions?
a. b’coz hard –coding the fn. Call wud slow compilation of the program too much
b. b’coz hard –coding the fn. Call wud slow execution of the program too much
c. b’coz the correct fn. To call generally isn’t know at compile –time
d. b’coz virtual fns are always at compile-time so no run-time code is needed at all.
e. Compiler does hard-code direct calls 2 virtual functions.
15. what is accessibility of a protected member of a base class which is inherited privately?
a. private: b’coz the private inheritance makes everything frm the base class private in the derived class (ans)
DBMS
1. Indexing must be applied on fields that are
a. seldom refernced in query
b. containing few unique columns
c. on frequently searched columns
d. changed frequently
2.
3. The relational data model includes several types of data integrity .which type of data integrity is ensured by the use of a primary key?
a. entity integrity
b. domain integrity
c. referential integrity
d. relational integrity
4. a student has 3 diff. Teachers . Each of these teachers has several students. Which type of relationship in relation model would effective represent this?
a. 3 one-to-many relationships
b. two many-to-one relationships
c. a single many-to –many relationshjips
d. at least 2 many-to-many relationships
5. which of the following properties are required of a column or column sets for the column to function as a primary key?
a. no nulls
b. a clustered index
c. a non-clustered index
d. ther must be atleast 1 foreign key on tha same table.
6.
7. select a.pk, fn, b.zip, c.city from a, b, c wher a.pk=b.pk
tables a,b,&c each contain 100 rows & the primary key for tables a & b is pk. What is the maxm. No. of rows that could be returned by query
100
0
100,000
10,000
1,000,000
8. which of the following is only used with a foreign key constraint ?
a . primary key constraint
b. the refereces clause
c. a check constraint
9. which is used to return the no. of rows in a table?
a. sel;ect all count from tablename
b. select count(*) from tablename
c. select numrows from table name
10.
11. when writing sql queries , how do u control the query execution plan used by the databases
a. query directly against an idex instead of table
b. define a static cursor & specify the “using specific index’ keyword
c. most databases provide propreitory methods to give database hint
d. enclose quey in atransaction & add a statement using the “set search” keyword
12.
13.
14,. Which is not allowed in a trigger
a. update
b. select into
c. while
d. begin
15.select type, avg(price), min(price) from product group by category
what is wrong??
a. u can’t include multiple aggregates in a select list
there is no where clause
nothing
c/C++
1. when shud apointer p be a reference parameter?
when fn. Changes p, & u want the change to affect actual pointer argument
when fn. Changes p, & u do not want the change to affect actual pointer argument
when fn. Changes *p, & u want the change to affect actual pointer argument
when fn. Changes *p, & u do not want the change to affect actual pointer argument
when pointer points to large object
2. output???
Int y=1;
Int k=2;
Int *p1;
Int *p2;
P1=&y;
P2=&k;
p1=p2;
*p1=3
*p2=4;
printf(“%d”,y);
1
2
3
4
3.when shud u use a const reference paprameter ??
whenever the data type might be many bytes
whenever the data type might be many bytes, the fn. Changes the papramter within its body, & u do not want these changes to alter the actual argument
whenever the data type might be many bytes, the fn. Changes the papramter within its body, & u DO want these changes to alter the actual argument
whenevr the data type might be many bytes , & the function does not change the parameter within it body
4..6
A is a class & B is a new class derived from A
A a;
B b;
Bb1;
B b2;
4. what c++ syntax is used to declare that a class B is derived from Class A”
a. class A derives B {……};
b. class B: public A {,……..};
5. using the variable , which is legat?
a. a=b;
b. b=a;
c. b1=b2;
d. both a & b are legal but not c;
e. both a & c are legal but not b;
f. both b & c are legal , but not a;
6. suppose there ar e 2 fns. F has an argument of type A and g has an argument of type B. Which is correct?
a. both f(a) & g(a) are legal fn. Calls
b. f(a) is legal , but g(a) is not legal
c. f(a) is not legal , g(a) is legal
d. neither f(a) nor g(a) is legal fn call
7. template<class Item>
void foo(Item x);
which is right way to call with integer argument I?
a. foo(i);
b. foo<int > (i);
c. foo<Item>(i);
d. foo(<int> i);
e. foo(<Item > i);
8.
9. void quiz(int w)
{
if(w>1)
{ quiz (w/2);
quiz(w/2);
}
printf(“*”);
}
how many asterisks are printed by the function call quiz(5)?
a. 3
b. 4
c. 7
d. 8
10. void test_a (int n)
{
printf(“%d”,n);
if(n>0)
test_a(n-2);
}
test_a(4)?
a . 0 2 4
c. 0 2
d. 2 4
e. 4 2
f. 4 2 0
11. char string[8]=”abcdefg”;
*string=’\0’;
printf(“%s”,string);
a. compiler error
b. run-time error
c. no o/p, but no error
d. creates bcdefg
12. char string[8]=”abcdefg”
o/p :
printf(“%s\n”,string +3);
abcdefg
abc
defg
cdefg
13. main()
{ int I=-3, j=2,k=0,m;
m=++I&&++j||++k;
printf(“\n%d%d%D”, I,j,k,m);
–2 3 0 1
–2 3 1 1
–2 3 1 0
–2 3 0 0
14. main()
{
int I;
for(;![]()
{
printf(“%d”,I++)
if(I>10)
break;
}
}
a. condition in a for-loop is mudt
b. no error
c. 2 ; shud be dropped
15.void goop ( int z[]);//prototype
int x[10];
which ois the correct way to call goop
a. goop(x);
b. goop(x[]);
c. goop(x[10]);
d. goop(&x);
e. goop(&x[]);
16. int a=3,b=17;
a=b%a;
b=++a+5;
printf(“a,b);
2 8
2 7
3 7
2 8
none
18. how many time shello will be printed?
FILE *fp=fopen(“test.txt”,w)
Fprintf(fp,”hello”);
Fork();
1
2
0
none
19. int a;
int b=0;
while(a)
{
{ a&=a-1;
b++;
}
a &b
0 & 15
1 & 16
0 & 16
none
20. class A
{
public:
static int a;
A() {a=10};
};
int main()
{
A b;
Printf(“%d”,b.a);
Return 0;
}
will the program compile?
a yes
b. no
Related posts: