Sei sulla pagina 1di 9

Persistent Placement Papers Question

answers
What are callable collections in Java ?
A callable collection is an interface whose implementers define a
single method with no arguments. The Callable interface resembles
Run able, as both are designed for the classes which potentially
executed with another thread. The difference is Run able cannot
return value and throw an exception.
How to make a method thread safe without using synchronized
keyword ?
By using a flag to determine that the method is in use by a
running thread.
Ex: Class A{
private boolean inUse = false;
public methodA(){
if(!inUse){
inUse = true;
...
...
...
inUse = false;
}

}
You can also use built-in
synchronizers. java.util.concurrent.locks.ReentrantLock has the
same functionality as the lock you access when
using synchronized blocks and methods, and it is even more
powerful.

What is the purpose of sharepoint ?


Organizations use SharePoint to create websites. You can use it as
a secure place to store, organize, share, and access information
from almost any device. All you need is a web browser, such as
Internet Explorer, Chrome, or Firefox.
Write a script of generate n prime numbers ?
#include<stdio.h>

main()
{

int n, i = 3, count, c;

printf("Enter the number of prime numbers required\n");

scanf("%d",&n);

if ( n >= 1 )

printf("First %d prime numbers are :\n",n);

printf("2\n");

for ( count = 2 ; count <= n ; )

for ( c = 2 ; c <= (i 1) ; c++ )

if ( i%c == 0 )

break;

if ( c == i )

{
printf("%d\n",i);
count++;
}
i++;
}
return 0;

Write a program to print reverse of a number and check whether it is


palindrome or not ?
#include<stdio.h>
int main(){

int num,r,reverse=0,temp;

printf("Enter any number: ");

scanf("%d",&num);

while(num){

r=num%10;

reverse=reverse*10+r;

num=num/10;

printf("Reversed of number: %d",reverse);

return 0;
}
Temp = num;
if (temp == reverse)

printf("Number is a palindrome \n");

else

printf("Number is not a palindrome \n");


}

Write a program to check whether the entered year is leap year or


not ?
#include <stdio.h>
int main()
{
int year;

printf("Enter a year to check if it is a leap year\n");


scanf("%d", &year);
if ( year%400 == 0)
printf("%d is a leap year.\n", year);
else if ( year%100 == 0)
printf("%d is not a leap year.\n", year);
else if ( year%4 == 0 )
printf("%d is a leap year.\n", year);
else
printf("%d is not a leap year.\n", year);
return 0;
}

How many requests will be send to server and response


coming from server when you open a web page (e.g.
xyz.php) which has an image tag?
4 image tag requests and 1 head tag req.

Explain 5 Test Metrics ?


The below metrics are used for evaluating application system
testing.

1. User participation(user participation test time divided by total


test time): Metric identifies the user involvement in testing.
2. Acceptance criteria tested(acceptance criteria verified versus
tatal acceptance criteria): Metic identifies the number of useridentified criteria that were evaluated during the test process
3. Defects uncovered in testing( defects located by testting versus
total systems defects):Metric shows the percent of defects that were
identified as a result of testing.
4. Hang-up analysis(installed changes versus number of application
system hang-ups) Metric show the effectives of testing in reducing
system hang-ups through maintenence changes.

5.

Test Automation(cost of manual test effort versus total test cost):


Metric shows the percent of testing performed manually and that
performed automatically.

Explain the pros and cons of testing the software by Development


team and by Testing team ?
If testing is done by development team they may fail to catch bugs
because
1) They dont have time to test the software.
2) They test in the same way as they have developed so they are
not able to catch bugs.
If testing is done by test engineer
1) they have to time to catch bugs so they are successful in
catching bugs.
2) They test in different ways so they are able to find more bugs.

Write a program to tell that the three set of co-ordinates


lie on the same line ?

m1=(y2-y1)/(x2-x1);
m2=(y3-y2)/(x3-x2);
if(m1==m2)
{
printf("3 points are on same line")
}
else
{

printf("not on same line");


}

Write a program to reverse a string (Love is God becomes


God is love).
#include<stdio.h>
#include<conio.h>
Int main()
{
Char str[50];
Int i , j , k;
Printf(\nEnter the string\t);
Fflush(stdin);
Gets(str);
Puts(str);
For(i=0;str[i]!=\0;i++);
For(k=I;k>0;k--)
{
If(str[k]==|| k==i)
{
For(j=k-1;(str[j]!=)&&(j!=-1);j--);

{
While(++j!=k)
{
Printf(%c,str[j]);
}
Printf( );
}
}
}
Printf(\n);
}

What do you mean by platform independent in java ?


Java is platform independent language because of the bytecode
magic of java. When we execute the source code, it generates the
.class file comprising the bytecodes. Bytecodes are easily
interpreted by JVM which is available with every type of OS we
install.
Whereas C and C++ are compiled languages which makes them
platform dependent. The source code written in C/C++ gets
transformed into an object code which is machine and OS
dependent. Thats the reason why C and C++ languages are termed

as platform dependent.
In the following code, how many times does the foo() is called ?
for(i = 1; i<=100;i++)
for(j= i;j<=100;j++)
foo();
Answer 5050 times.
Bcoz it will follow the pattern : i

1 to 100 = 100times

2 to 100 = 99times

3 to 100

4 to 100

5 to 100

6 to 100

..

99

99 to 100

100

100

Thus, 1+99,2+98,3+97,49+51 as well as 50 also.


Total = 5000+50 = 5050

Potrebbero piacerti anche