Thursday, 25 December 2014

Use this steps to record HTML pages in each of your mouse click :-

#Type CMD         ->Go to Command Prompt
#Type PSR.EXE ->A tab will flash now

Now at each of your mouse click a page gets saved.

U can use this to record while going through slides for later reference.

Sunday, 21 December 2014

GCD of Two Number in Wipro Format

int g=0,i=0;
g = gcd(input2[0], input2[1]);
if(input1 > 2){
for(i=2; i < input1; i++)
{
g = gcd(g, input2[i]);
}
}
Output1=g;
}
public static int gcd(int a, int b)
{
 if (b == 0)
 {
  return a;
 } else
 {
  return gcd(b, a % b);
  }  
int g=0,i=0;
g = gcd(input2[0], input2[1]);
if(input1 > 2){
for(i=2; i < input1; i++)
{
g = gcd(g, input2[i]);
}
}
Output1=g;
}
public static int gcd(int a, int b)
{
 if (b == 0)
 {
  return a;
 } else
 {
  return gcd(b, a % b);
  }    

GCD Of Two Number

public class GCDExample {
 
    public static void main(String args[]){
          //Enter two number whose GCD needs to be calculated.    
        Scanner scanner = new Scanner(System.in);
        System.out.println("Please enter first number to find GCD");
        int number1 = scanner.nextInt();
        System.out.println("Please enter second number to find GCD");
        int number2 = scanner.nextInt();
   
        System.out.println("GCD of two numbers " + number1 +" and "
                           + number2 +" is :" + findGCD(number1,number2));    private static int findGCD(int number1, int number2) {
        //base case
        if(number2 == 0){
            return number1;
        }
        return findGCD(number2, number1%number2);
    }
  }
Output:
Please enter first number to find GCD
54
Please enter second number to find GCD
24
GCD of two numbers 54 and 24 is :6

Friday, 19 December 2014

MISCELLANEOUS MCQ'S

**which command is used to add the values for the newly inserted column
1.insert
2.update
3.merge
4.all
           ans: insert
**syntax fa superclass constructor?
         super();
         super(parameter list);
         both a n b
         supers();
    ans: c
***which cmd is used to display name of a pgm path in prompt window,in java?
rs,vs,cs,ls
ans: ls
**what does cat command do:
      creates a file
      display contents of file
       concatenate 2 files
         all
    ans: a or d
**Default value of unmask
    022
    666
    700
    242
ans: 022
**Which symbol is used to specify a group of characters in SQL server database?
#    %    @    ^
ans:%
**True about string class in java??
       String class is immutable
        Final
        Abstract
        ASAP
       ans: 1&2
***if no arguments are passed to a cmd then argc will hve
1.1
2.0
3.2
4.total size of argv
ans:1
***Which command is used to view the columns of a table using SQL code?
dp_columns
sp_columns
tp_columns
None of these
ans:2
***data dictionary will be accessed from 
1.database
2.backup files
3.external files
4.all the above
ans:1
***wich of follwin is nt file stream opened automatically in unix prgm?
1.standard i/p
2..standard terminal
3..standard error
4..standard output
ans:2
***TRUNCATE is discussed under
1.ddl
2.dml
3.dcl
4.tcl
ans:1
***choose best
1.An interfac in wch all methods difinitions are defined
2.An interface consistin of no method
3 there is no such marker interfac in java
4 An interfac consistin of method prototypes only and not method definitns
ans:4
***command to reveal details of user
 w, finger,who,detail
ans: who
***Command used to break the output in two streams :
tar       tr     tail     tee
ans:tee
***what happens if exception is thrown by the finalize method?
the object would not be garbage collected
the object would still be garbage collected
it is unpredictable
the finalise method has nothing to do with garbage collection
ans:d
***the mv command will change?
i-node number
only the directory entry
directory entry and i-node number
none of the above
ans:1 or 2
***how to specify the start and end of each html table cell in a row
1.<tr> </tr>
<th> </th>
<tc> </tc>
<td> </td>
ans:4
**max size of varchar2 data type_______
ans:4000
**In which class/interface are wait and notify methods defined
class
object
runnable 
none
ans:2
**how many parameters can be passed to main()
1
2
3
many
ans:2
**which of the following is not a file stream opened automatically in unix system?
standard input
standard terminal 
standard error
standard output
ans:2
**which testing is done by programmers and not by testers in validation phase?
a.system testing
b.usability testing
c.acceptance testing
d.unit testing
ans:d
**in unix aray value assigned is surrounded by
{}
[]
()
$
ans:()
**Best suits marker interface
       1;All methods defined
        2;No methods in it
       3:No marker interface in java
         4:Contains prototype no methods def
ans:3
**Testing concern with behavior of shole producct defined by whole project
Intdgratin
Alpha
Beta
System
ans:system
***Which field types contain a fixed set of constants. 
         Class
        Enum
        Enum
         Dnum
ans:enum
**testing the desing is done in
       unit testing
      integration testing
      system testing
      acceptance testion
ans:4
**deep cloning of an object can be acheived by------------
ans: serialization
***which of the following true abt string class in java
a. string class is mutable
b. string clss is final
c. string class is abstract
options
a and b
a and c
b and c
b and c
ans:1
***Printf (3+ 3+"arun kumar", "prateek");
Watvl be output??
6arun kumarprateek
Arun kumarprateek
Umarprateek
Umar
ans:4
**whch command is use for recursiv listing of files
$is -r
$is -R
$is -a
$is -F
ans:2

UNIX MCQ'S

UNIX


1.Command used to display name of path in prompt is Ans: ls
2. Which directory contains the directory and blocks special files in unix ? Ans: etc
3. mv command will change Ans: i-node no
4. Which of the following metacharacters holds their special status within double quotes?
?
*
$
&
Ans: $ &
5. Which is not a file stream opened automatically in a unix? Ans:Std terminal
6. which command is used to interactively delete files?
7. wc command when used with arguments will?
Ans: wait for user to type in as i/p and displays count for that i/p
8. cat x?  Ans : read from file x
9. which of these commands is not a filter?
1 sort
2 grep
3 cal
4 cut
Ans : cal
10. cd will return the exit status as
Options:
1for success 
1for failure
 0for failure 
none             
 Ans:none(doubt)
11.Which of the followinng unix command will not take the user student5 to this personal home directory? 
1 cd
2 cd/~
3 cd ~
4 cd~ student5                optn2 (not sure check it)
12. COMMANDS TO FIND ALL PROCESSES RUNNING ALONG colonel process  Ans: ps-ef
13. the open mode of a file can combine two or more parameters by using ?
a. bitwise or
b. bitwise and
c. both of the above
d. open mode cant combine two parameters
Ans:
14. unix command to display the names of all users have currently logged in
a. who
b.who am i
c.whoami
d.su
Ans:who am I
15. Used to indicate mark elememt is deprecated and no longer used..
 Ans: @deprecated
16. ecursive listing of all
opn;4ls-r 4IS-R 4IS-a 4ls-F                

Ans: 4IS-R

TESTING MCQ'S

TESTING


1.System specification LHS of the V life cycle
corresponds to the   SYSTEM TESTING
2.Boundary value analysis and cause effect graphing are methods of  BLACK BOX TESTING
3. Work products that undergoes reviews are SYSTEM DESIGN
4. Effective document used for verification is REVIEW
5. Verification is STATIC type of testing
6.Misunderstanding of what modules leads to FAULT
7. Aftr retesting if the defect fix is satisfactory then it is marked as 
8. if major flaws occur toward the bottom of the program, this approch is advantegious BOTTOM UP APPROACH
9.DYNAMIC TESTING  is process of evaluating system or structure or documentation
10. Unit testing also known as MODULE or COMPONENT TESTING
11. Form of functional testing BOUNDARY
12. incorrect comparision of variables is directed by:
integration testing
system testing
UAT
none               ans none(chk)
13.UNIT TESTING is done by programmers and not by testers in validation phase.
14. In testing concept test plan should be SPORDIAC
15. A principle measure of the completeness of test is based on the no of test cases IMPLEMENTED
16. benefits of a review is :
     1 certifying correctness
     2  encouraging uniformity
     3 finding defects
4 both a and b
Ans:both a and b
17. in V model of testing component desgin coresponds to 
1)unit
2)alpa
3)integration
4)user acceptance 
Ans:
18. the _____________ team is a group of individuals i.e.(author,moderator.reader.recorder.inspectoer)
1)walkthrough
2)inspection
3)review 
4)testing
Ans:
19. At which stage of inspection process each inspector examines d work product to find defect?
 Ans: Preparation
20. Defects can also be tracked by:
Ans:Excel sheets

DBMS MCQ


DBMS


1.How many null values r allow in unique key column? Ans : Infinite
2. we cannot define constraints on-------database?? Ans: Lob
3. field value can be found at the intersection of:  Ans : a row and column
4. Which stemement is true
1;intersect doesnot ignore null values
2;reversing intersected tables doesnot alter result
Ans: Both
5. .............. values are not ignored during duplicate checking in UNION
Ans:NULL
6. Illegal symbol for table name?
$
#
!
_
Ans: !
7. Grant and revoke are discussed under? Ans:DCL
8. ................ is a synoym for USER_TABLES Ans : TABS
9. which of the following is not a set operator?
1 UNION
2 JOIN
3 MINUS
4 INTERSECT                  
Ans:Join
10. collection of objects under a user  Ans:Schema

11. which is not set operator??
          1  Union
          2 Intersect 
          3  Minus
         4 Join
Ans : Join
12. what does execute(sqlquery) method called on a statement object return
1)int
2)boolean
3)string
4)resultset
Ans:
13. constraint names and their corresponding column names can be listed from
a. USER_CONSTRAINTS
b. USER_OBJECTS
c. USERS_CONSTRAINTS
d. USER_CONS_COLUMNS
Ans:USER_CONS_COLUMNS
14. WHICH VALUES R NOT IGNORED DURING DUPLICATE CHECKING IN UNION
    1.NULL
   2.0
   3.STRING
   4.DATE
Ans:NULL
15. In Oracle 11g to compare 2 string values which of the following operations can be used
1.=
2.==
3.strcmp()
4.isequals...
Ans:Equals
16. Which symbol is used to specify a group of characters in SQL server database?
1.#
2.%
3.@...
4.^
Ans:%
17. oracle sql>> truncate is discussed under?1.dml,ddl,dcl,tcl?
Ans:DDL


Program for Frequency Counts



CODE

int f[]=new int[26];
for(int i=0;i<26;i++)
{
f[i]=0;
}
char[] charray=new char[]{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

for(int m=0;m<input1.length();m++)


for(int ck=0;ck<26;ck++)

{

if(input1.charAt(m)==charray[ck])

{
f[ck]++;
}
}
}
for(int ck=0;ck<26;ck++)
{
if(f[ck]!=0)
System.out.println(charray[ck]+" \t\t "+f[ck]);
}

}}

Program for Longest Palindromic Subsequence





CODE


public static void method1(String input1)
{
String b="";
int max1=0;
for(int i=0;i<=input1.length();i++)
{
for(int j=i+2;j<=input1.length();j++)
{
b=(String)input1.subSequence(i,j);
max1=pali(b);
if(max1>output1)
{
output1=max1;
}
}
}
System.out.println(output1);
}
public static int pali(String s)
{
int max=0;
String reverse="";
for ( int i = s.length()- 1 ; i >= 0 ; i-- )
{
reverse = reverse + s.charAt(i);
}
if(reverse.equals(s))
max=s.length();
return max;
}

LCM - Java

LCM
int num1, num2; int a = input1, b = input2; bool flag = false; if (a > b) { num1 = a; num2 = b; } else { num1 = b; num2 = a; } for (inti = 1; i<= num2; i++) { if ((num1 * i) % num2 == 0) { output1=i * num1; flag = true; break; } } if(!flag) output1 = num2; }

Program for Modular Exponentiation




CODE...

int m=(int)Math.Pow(input1, input2);

output1 = m % input3;

Number of arrangements for given n numbers - java

find the number of arrangements for given n numbers in which no number exists in exact position .formula for this?
class Program { public static int output1; public static void derangement(int input1) { int n = input1; int op = fact(n); double sum = 0; for (int k = 0; k <= n; k++) { sum += Math.Pow(-1, k) / fact(k); } output1 = Convert.ToInt32(op * sum); } public static int fact(int n) { int f = 1; for (int i = 2; i <= n; i++) { f *= i; } return f; } static void Main(string[] args) { derangement(3); Console.WriteLine(output1); Console.ReadLine(); } } }

Program for Lowest Common Multiple




CODE

int a, b, t;
a = input1;
b = input2;
while (b != 0)
{
t = b;
b = a % b;
a = t;
}

output1= (input1 * input2) / a;

Program for Sum Of Divisors





CODE

int sum=0;
for(int i=1;i<=input1;i++)
{
if(input1%i==0)
{
sum=sum+i;
}
}
output1=sum;






Program for Longest Common Subsequence





CODE ---->

String temp, output = null, target1 = null, target2 = null;
int max = 0;
if (input1.length() <= input2.length())
{
target1 = input1;
target2 = input2;
} else
{
target1 = input2;
target2 = input1;
}
for (int i = target1.length() - 1; i >= 0; i--)
{
for (int j = 0; j <= i; j++)
{
temp = target1.substring(j, i + 1);
System.out.println(temp);
if (target2.indexOf(temp) >= 0)
{
if (temp.length() > max)
{
output = temp;
max = temp.length();
}
}
}
}
output1=max;(//try)
System.out.println(max+" "+output);

Program for Caeser Cipher




Solution-
//you have to write just the logic part in exam, Header part will be provided by system as You can see in the pic.


int l = input1.length();
char o[] = new char[l];
for (int i = 0; i < l; i++)
 {
char a = input1.charAt(i);
  int b = (int) a;
b = b + 3;

            if (b == 123)//for a
            {
                b = 97;
            }
            if (b == 124)//for b
            {
                b = 95;
            }
            if (b == 125)//for c
            {
                b = 99;
            }
            char m = (char) b;
            o[i] = m;
        }

   output1 = Arrays.toString(o);

Java Programs - My name is khan

my name is khan program........

 public static void minWindow(String S, String T)
{
int[] needToFind = new int[256];
int[] hasFound = new int[256];
for (int i = 0; i < T.length(); ++i)
{
needToFind[T.charAt(i)]++;
}
int count = 0;
int minWindowSize = Integer.MAX_VALUE;
int start = 0, end = 0;
String window = "";
for (; end < S.length(); end++)
{
if (needToFind[S.charAt(end)] == 0)
{
continue;
}
char c = S.charAt(end);
hasFound[c]++;
if (hasFound[c] <= needToFind[c])
{
count++;
}
if (count == T.length())
{
while (needToFind[S.charAt(start)] == 0
|| hasFound[S.charAt(start)] > needToFind[S.charAt(start)])
{
if (hasFound[S.charAt(start)] > needToFind[S.charAt(start)])
{
hasFound[S.charAt(start)]--;
}
start++;
}
if (end - start + 1 < minWindowSize)
{
minWindowSize = end - start + 1;
window = S.substring(start, end + 1);
}}}
output1= window;

Java MCQ-1

Multiple Choice Questions of Java

1.Which method name follows the javabeans std :Getcust
2.You cannot close() method in : Drivermanager Object
3. Not a javascriptwindowobject func?
alert
prompt
confirm
all
Ans: all
4. garbage collector daemon chooses which of these objects to perform its function? Unreachable obj.
5. Invalid format string:
%ld
%lf
%lu
%lc
Ans :%lc
6. write() method is associated with which javascript object  Ans: Document
7. Static method pertainng to a state of a thread  Ans: yield and sleep
 8. Java isnan when an object on page uses focus which event occurs Ans: on blur
9. Which is valid java script identifier:first name, _123 123_ a*b
Ans: _123
10. Content of ur webpage r contained directly within which object  Ans :Document
11.Start and end od HTML table cell??
Ans: <td> </td>
12.Where can objects store its states? Ans: Fields
13. method - local class > can b marked  Ans: final
14.What could one use to create threads in java? a) runnable interface (b) thread class (c) runnable class (d) thread interface
Ans: a b
15.Does anabstract class can have both abstract nd concrete methoks? Ans:Yes
16. Which operator compares an object to specified type in java? Ans; instanceOf
17. marker interface is …….. Ans:an empty interface
18. Which of foll methods belong to object class
a)run()
b) notify()
c) start()
d) wait()
e) notifyAl()
Ans:b d e
19. %lf stands for? Ans: long double
20.Which of the following are valid return statements?
1. return(10);
2 .return (10.15);
3 .return;
Ans: 1,2,3
21. what is garbage collector? Ans: low priority thread
22. when new classes of objects are developed by this process, the resulting collections of classes is called a class of Ans: Collections
23. in main (int argc,char " argv[] ), the argument argc represents   Ans:count of  total no of arguments
24.Which of the following is not a valid heading tag?
 1 <h 1> </h1>
2 <h3> </h3>
3 <h5>
4 <h7>
Ans:<h7>
24. Which is a valid keyword in java?
A. interface   B. String  C. Float  D. Unsigned
Ans: interface
25. which is not derived data type?
 1 class
 2 function
3 reference
4 array...
26. In java which is the single parameter defined by the main method ?
 1 str
 2 args
 3 int
 4 both a and b
Ans:args
27. In JDBC which of the following is a wrapper object for the sql query ?
 1 connection
2 result set
3 database metadata
4 statement
Ans:resultset
28.Which of the following is true about abstract class?
 1.An abstract class can have abstract methods only
2.An abstract class can have abstract as well as concrete methods
3.An abstract class cannot have any methods
4.It is not possible to have an abstract class without abstract methods
5.An abstract class cannot de initialized
Ans: 2 and 5
29. In java which of these is thread safe by default
1.hash set
2.list
3.vector
4.all the above
Ans:Vector
30.  which is true
string class is mutable
string class is final
string class is abstract
1.a&b...
2.a,b&c
3.a&c
4.b&c
Ans:
31. In java script what do isNaN functon indicate
Ans: Checks whether the given value is a number or not and returns a boolean value
32.The runnable interface consists of:
 Ans: Run() and start() methods
33. Assume that there are two cases. A is the base class nd B is the derived class. the default contructer of which class will be called first?
Ans:Base class
34. To perform operations such as setw, setprecision on streams, which header files has to be included?
1 iostrem
2 fstream
3 sstream
4 iomanip                 
Ans: iomanip

31.Which of the following pair is used to create bulleted lists?
Ans:<bl> </bl>
32.How to specify the start and end of an HTML table row?
Ans:<tr> </tr>
33. .OUTPUT????
class abc
{
public static void main(String args[])
{
byte a=64,b;
int i;
i=a<<2;
b=(byte)(a<<2);
System.out.println("a="+a);
System.out.println("i and b="+i+" "+b);
}
}
Ans: a=64
i and b=2560
34. 
27.int bar=1;{
int bar=2;
println(bar);
}
opn;compile error bar=1 bar=2 run time error Ans:Compiler Error
1.Which of the following is req 4 construction of singly linked list??
Ans : malloc()
2. Which data structure needs only 1 pointer to manage links?
Ans:Arrays
3. It is syntactically valid to define a func in to anothr func
True
False
Ans : True


stay connected for more updates