Documente Academic
Documente Profesional
Documente Cultură
Hello
What will be the output of the program? B.Hi Hello
#include<stdio.h> C.No output
int i;
D.Infinite loop
int fun();
int main()
{
while(i)
{
fun();
A
main();
1 }
printf("Hello\n");
return 0;
}
int fun()
{
printf("Hi");
}
int main() C
{
int *x;
*x=100;
return 0;
}
Q.No.2 Which of the following statements A.float **fun(float***);
correctly declare a function that receives a B.float *fun(float**);
pointer to pointer to a pointer to a float and C.float fun(float***);
returns a pointer to a pointer to a pointer to a D.float ****fun(float***); D
pointer to a float?
3 Q.No.1 A.remove(var-name);
How will you free the allocated memory? B.free(var-name);
C.delete(var-name); B
D.dalloc(var-name);
Q.No.1 a) public
4
b) private D
Which of these following members are not c) protected
accessed by using direct member access
operator? d) Both a & b
Q.No.2 a) 1
b) 2
How many objects can present in a single c) 3 D
class? d) as many as possible
5 Q.No.1 a) void
What is the return type of the conversion b) int
operator? c) float D
d) no return type
Q.No.2 a) 3 B
What is the output of this program? b) 4
#include <iostream> c) 5
using namespace std; d) None of the mentioned
class sample
{
public:
sample(int i) : m_i(i) { }
public:
int operator()(int i = 0) const
{
return m_i + i;
}
operator int () const
{
return m_i;
}
private:
int m_i;
friend int g(const sample&);
};
int f(char c)
{
return c;
}
int main()
{
sample f(2);
. cout << f(2);
return 0;
}
Q.No.1
Pick out the correct statement. a) Increment operator ++ adds 1 to its
6
operand
b) Increment operator ++ adds 2 to its
operand
A
c) Decrement operator ++ subtracts 1 to its
operand
d) None of the mentioned
Q.No.2 a) A derived class’s constructor cannot B
explicitly invokes its base class’s
Pick out the correct statement constructor.
b) A derived class’s destructor cannot
invoke its base class’s destructor.
c) A derived class’s destructor can invoke
its base class’s destructor.
d) None of the mentioned
Q.No.1 a. Top-in-first-out
b One-end-first-out
Stack is a an ordered collection of items c Last-in-first-out C
10 forming a list that is
Q.No.2 a Stable
The nature of collection of data items in a b Unstable
stack is c Dynamic C
11 Q.No.1 a. Deque
To represent hierarchical relationship between b. Priority
elements, which data structure is suitable? c. Tree
d. All of above C
12 Q.No.1 A
At any point of time, the number of elements a rear - front + 1
in the queue is given by b rear - front
c rear-1
Q.No.1 a. Dn = n log2n
b. Dn = n log2n+1
c. Dn = log2n D
The depth of a complete binary tree is given
d. Dn = log2n+1
by
Q.No.2 A binary tree can easily be converted into a. by replacing each empty sub tree by
13 q 2-tree a new internal node
15 Q.No.1
In a graph if e=[u, v], Then u and v are called a. endpoints of e D
b. adjacent nodes
c. neighbors
d. all of above
Q.No.2 a. a tree graph
b. free tree
A connected graph T without any cycles is c. a tree D
called
d. All of above
Q.No.2 a. isolated
If every node u in G is adjacent to every other b. complete
node v in G, A graph is said to be c. finite B
d. strongly connected
17 Q.No.1 a. FAEKCDBHG
When in order traversing a tree resulted E A C b. FAEKCDHGB B
K F H D B G; the preorder traversal would c. EAFKHDCBG
return d. FEAKDCHBG
19 Q.No.1 a. Sorting
b. Merging
The operation of processing each element in c. Inserting D
the list is known as
d. Traversal
Q.No.2 a. Arrays
b. Records
Which of the following data structure can't c. Pointers A
store the non-homogeneous data elements?
d. None
22 Q.No.1
What will be the output of the program? C
#include<stdio.h> A. 2 4
36
#include<stdarg.h>
B.
void dumplist(int, ...);
248
3, 6, 9, 7
int main()
C.
{
48
dumplist(2, 4, 8);
697
dumplist(3, 6, 9, 7);
D.
return 0;
111
}
1111
void dumplist(int n, ...)
{
va_list p; int i;
va_start(p, n);
while(n-->0)
{
i = va_arg(p, int);
printf("%d", i);
}
va_end(p);
printf("\n");
}
Q.No.2 A. x is a pointer
What is x in the following program? B. x is an array of three pointer
#include<stdio.h> C. x is an array of three function pointers
D. Error in x declaration
int main()
{ C
typedef char (*(*arrfptr[3])())[10];
arrfptr x;
return 0;
}
23 Q.No.1 A. *pt='';
Which statement will you add to the B. pt='\0';
following program to ensure that the C. pt='\n';
D
program outputs D. *pt='\0';
"CDAC" on execution?
#include<stdio.h>
int main()
{
char s[] = "CDAC";
char t[25];
char *ps, *pt;
ps = s;
pt = t;
while(*ps)
*pt++ = *ps++;
Q.No.2 A. Mello A
What will be the output of the B. Hello
program ? C. HMello
#include<stdio.h> D. MHello
int main()
{
char str[20] = "Hello";
char *const p=str;
*p='M';
printf("%s\n", str);
return 0;
}
Q.No.2 A. 5
What will be the output of the program ? B. 4
#include<stdio.h> C. 6
int main() D. 7
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
B
printf("%d\n", sizeof(arr)/sizeof(arr
[0]));
return 0;
}
25 Q.No.1 A. 10
What will be the output of the B. 20
program ? C. 30 B
#include<stdio.h> D. 0
int main()
{
union var
{
int a, b;
};
union var v;
v.a=10;
v.b=20;
printf("%d\n", v.a);
return 0;
}
Q.No.2 A.-1, 0, 1, 2, 3, 4
What will be the output of the program ? B. -1, 2, 6, 3, 4, 5
#include<stdio.h> C. -1, 0, 6, 2, 3, 4
int main(){ D. -1, 0, 6, 7, 8, 9
enum days {MON=-1, TUE, WED=6, THU,
FRI,
SAT}; D
printf("%d, %d, %d, %d, %d, %d\n", MON,
TUE, WED, THU, FRI, SAT);
return 0;
}
i^j);
return 0;
}
Q.No.2 A. 2, 2 A
What will be the output of the program B. 8, 8
in 16- C. 5, 5
D. 4, 4
bit platform (under DOS)?
#include<stdio.h>
int main()
{
struct node
{
int data;
struct node *link;
};
struct node *p, *q;
p = (struct node *) malloc(sizeof(struct
node));
q = (struct node *) malloc(sizeof(struct
node));
printf("%d, %d\n", sizeof(p), sizeof(q));
return 0;
}
27 Q.No.1 a) 10 A
b) 11
What is the output of this program? c) 20
#include <iostream> d) 22
using namespace std;
class number
{
int i;
public:
int geti();
void puti(int j);
};
int number::geti()
{
return i;
}
void number::puti(int j)
{
i = j;
}
int main()
{
number s;
s.puti(10);
cout << s.geti( );
return 0;
}
is ";
cout << var << "\n";
}
};
int main()
{
sample object;
object.input();
object.output();
object.var();
return 0;
}
Q.No.1 a) 3 4
What is the output of this program? b) 4 3
#include <iostream> c) 4
using namespace std; d) 3
class BaseClass
{
protected:
int i;
public:
31 BaseClass(int x)
{
i = x; B
}
~BaseClass()
{
}
};
class DerivedClass: public
BaseClass
{
int j;
public:
DerivedClass(int x, int y):
BaseClass(y)
{
j = x;
}
~DerivedClass()
{
}
void show()
{
cout << i << " " << j <<
endl;
}
};
int main()
{
DerivedClass ob(3, 4);
ob.show();
return 0;
}
35 Q.No.1 a ABCD**+
The postfix form of the expression b AB*CD+* B
(A*B)*(C+D) is c AB*CD*+
Q.No.2 a (a + 1) * b – b
a*b can be defined recursively as b (a – 1) * b + b B
c (b + 1) * a – b
b. LOC(Array[5])=Base(Array[5])+(5-
38 lower bound), where w is the number
of words per memory cell for the A
array
c. LOC(Array[5])=Base(Array[4])+(5-
Upper bound), where w is the
number of words per memory cell for
the array
d. None of above
39 Q.No.1 The space factor when determining a. Counting the maximum memory needed A
the efficiency of algorithm is measured by by the
algorithm
b. Counting the minimum memory needed
by the algorithm
c. Counting the average memory needed by
the algorithm
d. Counting the maximum disk space
needed bythe algorithm
Q.No.2.The Worst case occur in linear search a. Item is somewhere in the middle of the
algorithm when array
b. Item is not in the array at all
c. Item is the last element in the array D
d. Item is the last element in the array or is
not there at all
Q.No.1 Arrays are best data structures a. for relatively permanent collections of
40 data
b. for the size of the structure and the data A
in the structure are constantly changing
c. for both of above situation
d. for none of above situation
Q.No.2 a. by this way computer can keep track
The elements of an array are stored only the address of the first element and
successively in memory cells because the addresses of other elements can be
calculated
b. the architecture of computer memory
does not allow arrays to store other than A
serially
c. both of above
d. none of above