CHALLENGES QUESTIONS!!!

๐Ÿ”‘ KEY TO SUCCESS!!!!

                                                 DAY-1

Q.1.What Is the output printed by the following programs?


#include
int f(int n,int k)
{
   if(n==0) return 0;
elseif (n%2) return f(n/2,2*k)+k;
else return f(n/2,2*k)-k;
}
int main()
{
  printf("%d",f(20,1);
return 0;
}

A. 5
B. 8
C. 9
D. 20


Q.2.  A Binary search tree is generated by inserted in order the following integers?

50,15,62,5,20,58,91,3,8,37,60,24

The number of nodes in the left subtree and right subtree of the root respectively is.

A.(4,7)
B.(7,4)
C.(8,3)
D.(3,8)



Q.3. How many distinct BSTs can be constructed with 3 distinct Keys?

A. 4
B. 5
C. 6
D. 9



 
                                                                    DAY-2

Q.4. What is the output of the following C Program?

#include
main()
{
 int i,j,x=0;
for(i=0;i<5 i="" p="">for(j=0;j{
<5 i="" p=""> x=(i+j-1);
break;
}
printf("%d",x)
}

A. 6
B. 5
C. 4
D. 3


Q.5. A tree has 2n vertices of degree 1,3n vertices of degree 2,n vertices of degree 3.determine the number of vertices and edges in tree.

A. 12,11
B. 11,12
C. 10,11
D. 9,10

Q.6. While inserting the elements 71,65,84,69,67,83 in an empty binary search tree(BST) in the sequence shown,the element in the lowest level is.

A. 65
B. 67
C. 69
D. 83


Q.7. Assume the following C variable declarations:

int *A[10],B[10][10];
of the following expressions:

1. A[2]
2. A[2][3]
3. B[1]
4. B[2][3]

Which will not give compile time errors if used as left hand sides of assignment statements in a C program?

A. 1,2,4 ONLY
B. 2,3,4 ONLY
C. 2 , 4 ONLY
D. 4 ONLY

<5 i="" p="">



<5 i="" p="">                                                                          DAY-3
<5 i="" p="">
<5 i="" p="">Q.8. Consider the c function given below .Assume that array list A contains n(>0).elements sorted in ascending order.
<5 i="" p="">  
<5 i="" p="">int Process Array(int*list A,int x,int n)
<5 i="" p="">{
<5 i="" p="">int i,j,k;
<5 i="" p="">i=0;
<5 i="" p="">j=n-1;
<5 i="" p="">do
<5 i="" p="">{
k=(i+j)/2;
if(x<=list A[k])
j=k-1;
if(list A[k]<=x)
i=k+1;
}
while(i<=j)
if(list A[k]==x)
return(k);
else
return-1;
}

Which of the following statements above the function process Array is correct?

A. It will run into an infinite loop when x is not in list A.
B. It is an implementation of binary search.
C. It will always find the maximum element in list A.
D. It will return -1 even when x is present in list A.

Q.9. Java virtual machine (JVM) Is used to execute archietactural neutral byte code. which of the following is needed by the JVM for execution of java code?

A. Class loader only.
B. Class loader and java interpreter.
C. Class loader, java interpreter and API.
D. Java interpreter only.

Q.10. Let A be the base class in C++ and B be the derived class from A with protected inheritance . Which of the following statements is False  for class B?

A. Member function of class B can access protected data of class A.
B. Member function of class B can access public data of class A.
C. Member function of class B cannot access private data of class A.
D. Object of derived class B can access public base class data.


Comments

Popular posts from this blog

SUVICHAR->1(17,NOVEMBER,2020)

18,NOVEMBER,2020 (DAYWISE BLOG)