Sunteți pe pagina 1din 7

SOAP: Simple Object Access Protocol is a protocol that is used to exchange struc tured information at the time of implementing

a web service. SOAP is relied on X ML. Message format of SOAP usually relies on another protocol of different appli cation layers. Among these the most notable application layer is Remote Procedur e Call and HTTP. SOAP forms the foundation layer for web services protocol stack . This stack provides the basic framework for messaging on which the web service s are built. WSDL: Web Service Definition Language is used to describe a web service based on XML. WSDL is used for describing Web Services and to locate the services. WSDL consists of the information on what the service is all about, its residing locat ion and the way of invocation the service. UDDI Universal Discovery Description Integration: To publish and discover the in formation about web services, UDDI is a specification. It is an XML based standa rd. This standard is used for describing, publishing, and finding services. Thes e services are found in a distributed environment through the use of a server ca lled registry server. Electronic Business using XML: EBXML is one from XML family that is based on the standards of OASIS and UN/CEFACT. The mission of this standard is to provide an open xml-based infrastructure which could enable the global use of e-business i n an interoperable, secure and consistent manner by all of the partners of tradi ng. This is a unique architecture with unique concepts that are part theory and part implemented within the existing EBXML standards. JAX PACK: A java API for xml pack that integrates all of the programming interfa ces by SUN for different web services development. All these interfaces are made as a single download. JAX PACK is a bundle of JAXB,JAXM,JAX-RPC,and JAXR. Jax p ack includes the documentations for support for the SAX,DOM.SOAP,WSDL,XSLT,EBXML ,UDDI standards. 1)A Simple Object Access Protocol (SOAP) enables the heterogeneous operating sys tem to communicate with one another by using Hypertext Transfer Protocol (HTTP) and its Extensible Markup Language (XML) as the mechanisms for information excha nge. 2)Web Services Description Language (WSDL) is an XML-based language used to desc ribe the services business offers, which can be accessed electronically. 3)Universal Description Discovery and Integration (UDDI) is a specification for maintaining standardized directories of information about Web services in a univ ersally recognized format. It records their capabilities, location and requireme nts. 4)The ebXML Messaging Service specification (ebMS) extends the SOAP specificatio n. It provides the security and reliability features. 5)It is supported by a variety of commercial and open source software implementa tions. 6)Due to the interoperability of its implementations, ebMS is a strong complemen t or even alternative to other web service specifications. 7)The Java APIs for XML (JAX) Pack integrates all of Sun's programming interface s for web services development and makes them available as a single download. * JARX is a standard API that are used to access XML registries (list of service s available on the web) from the JAVA platform. Client application can use JARX API to query the registries. It acts as a pluggable layer that allows access to registries implemented on different standards such as UDDI. * JAX-RPC uses SOAP to call remote procedures. JAX-RPC enables JAX-RPC clients t o invoke web services developed across heterogeneous platform.

/*############################################################################## ###################################################*/ 15.How do you convert a decimal number to its hexa-decimal equivalent.Give a C c ode to do the same /*############################################################################## ###################################################*/ 18.You are given some denominations of coins in an array (int denom[])and infini te supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called? /*############################################################################## ###################################################*/ 6.Given a string,find the first un-repeated character in it? Give some test case s ? not sure if i understood requirements $MAZHAR{ d in string 'aabbccd' c in string 'aabbcdd' a in string 'abbbccd' int selected = -1; for (int i=0; i< src.length(); i++){ if (i == (src.length()-1) && (src.charAt(i) != src.charA t(i-1)) ){ selected = i; break; } else if (i == 0 && (src.charAt(i) != src.charAt(i+1))){ selected = i; break; } else if ( ( i> 0 && i < (src.length()-1) ) && (src.charA t(i) != src.charAt(i+1)) && (src.charAt(i) != src.charAt(i-1)) ){ selected = i; break; } } if (selected >= 0 ){ System.out.println("First Occurence of of non-repeating character is"); System.out.println(src.charAt(selected)+" in string '"+s rc+"'"); } first un repeated char in a string: Iterate over all chars in the string. For each iteration copy the character to a temp array. If the character already exists in the temp array, move the charact ers in the temp array so that they overwrite the current char in it. If we reach the end of the string, the first character in the temp array is the first un re peated character. /*############################################################################## ###################################################*/

10.What is the time and space complexities of merge sort and when is it preferre d over quick sort? /*############################################################################## ###################################################*/ 11.Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression. boolean blnFound = find("a?b*bb", "axynacbpolibbxxx"); public static boolean find(String re, String text){ Boolean blnQuit = false; int OrignalLength = text.length(); while (!blnQuit){ if (myRegularExpression( re, text)){ System.out.println("at index : "+ (Orign alLength - text.length())); return true; } text = text.substring(1); if (text.length() < re.length()){ return false; } } return false; } public static boolean myRegularExpression(String re, String text){ int j = 0; boolean blnSterik = false; for(int i=0; i <text.length(); i++){ if (j == re.length()){ break; } else if (text.charAt(i) == re.charAt(j) ) { j++; blnSterik = false; } else if (re.charAt(j) == '?'){ j++; } else if (re.charAt(j) == '*') { j++; blnSterik = true; } else if (text.charAt(i) != re.charAt(j) && !blnSterik){ break; } } if (j == re.length()){ return true; } return false; } /*############################################################################## ###################################################*/

14.Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element. public static void findMissingNumer(int[] arr){ Boolean found = false; for (int i=1; i <= arr.length; i++){ found = false; for (int j=0; j < arr.length; j++){ if (i == arr[j]){ found = true; break; } } if (!found){ System.out.println("Missing number is : "+i); break; } } } for data like (1 to n+1) -----------------------public static void findMissingNumer(int[] arr){ Boolean found = false; for (int i=1; i < (arr.length+2); i++){ found = false; for (int j=0; j < arr.length; j++){ if (i == arr[j]){ found = true; break; } } if (!found){ System.out.println("Missing number is : "+i); break; } } } /*############################################################################## ###################################################*/ Q. 5.Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren t present. A. Input array[n] int sum = n * (n + 1) /2; int answer; for(i=0; i<n; i++) sum -= array[i]; answer = sum; your solution only works if there is only 1 missing number. However, the questio ns is asking for missing number(s). arr is input array int[] arrcount = new int[arr.length]; for (int i=0; i <arr.length; i++){ arrcount[ arr[i] ]++; } for (int i=0; i <arr.length; i++){ if (arrcount[i] == 0){ System.out.println("Missing number is : "+i); }

} /*############################################################################## ###################################################*/

You are given a dictionary of all valid words. You have the following 3 operatio ns permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.) MAZHAR{ based on my assumption and undrestnading, reading a character does not m atter, so max(len(word1), len(word2)) * 2 = are the combinatons e.g w1 = "wxyz", w2 = "abcde" read charcter from both strings (there is no cost), replace them in both string( 2 steps), keep on moving, until we reach at 5th index this index will be deleted from here and instered in other string(again 2) it makes = max(4,5) * 2 = 10 steps.

/*############################################################################## ###################################################*/ public void myFunction(int n) { if (n == 0) return; else { print(n); myFunction(n--); print(n); } } what does it show? MAZ{ stuck in infinite loop with positive/or negative int as cllFunc(a--) first passes the a and then -- it, which mean always same value is passed} if changed to --a will work fine, as if 5 passed output will be as follows 5, 4, 3, 2 , 1 , 0 , 1 , 2, 3 ,4 and if -5 passed -5 -6 -7 -8 -9 -10 -11 -12 -13 .... (infinite loop)

>>1) for non negative no. it show series of no as n n-1 ... 1 0 1 2 ... n-1... : ) for negative no. its will be an infinite loop... >>2) why it is infinite loop? Sequence is like below... -int_min...... -1 0 1 2 ...... +int_max if you pass -ve number then it will reach -int_min and then it go to +int_max an

d then deceased and reach to 0 and then function will return >>3)Thanks,I forgot to mention that n is positive >>4)it will print as n n-1......2.1.1.2.....n-1.n but no 0 as d code says. "if (n == 0) return; " >>5)it will print 0 for the second printf(n) statement for n = 1 >>6)negative integers infinite loop >>7)In java, the same programe will give us the output , suppose if our input is n=10 means then the output will be 10 10 10 10 10 10 10 ... at last JVM will th rough the StackOverFlowException You are right... because the value is of n is post-decremented, so n=10 is passe d every time. It's an infinite loop printing the same number that you fed the original call to MyFunction. Does not matter if the number is positive or negative. The postfix decrement returns the original n during evaluation, so you'll be stuck calling M yFunction(n) with the same value of n. And you'll never get to the second print due to the infinite loop, so the same number will be printed over and over and o ver again. /*############################################################################## ###################################################*/ /*############################################################################## ###################################################*/ Give an array of integers, which are in repeated format except one integer, writ e a function to return that integer ex[2,2,3,3,4,4,4,5,5] = 4 [2,2,2,3,3,3,3,4,4,4] = 3 1)You need to check first 3 repetition for the pattern. then only check first ch aracters of pattern skipping the remaining. If the next pattern char is same as previous check remaining char ahead if they don't resemble the same pattern you got the erroneous one... 2)You assumed that list is sorted, but lets extend the question for the case tha t list is not sorted! Using partitioning would be a potential answer with O(n) and another solution is using Hash Map, count the items in array using item as a key. 3)list is NOT sorted, but that shouldn't matter much. Any code solutions? 4)use binary tree to get the numbers arranged and get the count of numbers #include<iostream>#include<string>#include <map> using namespace std; //tree nodestruct TreeNode{ *rightNode; TreeNode(){} int data; TreeNode *leftNode; TreeNode TreeNode(int data){this->data=data;}};

//binary treeclass BinaryTree{ map<int,int> sameNumbers; TreeNode* rootNo de; //create binary tree void createTree(TreeNode*& rootNode,int data);

void showTree(TreeNode*& root); public: BinaryTree(){rootNode=NULL;} //starting point for creating tree, root is accessed from this func void ins ert(int data) { map<int,int>::iterator it; it=sameN umbers.find(data); if(sameNumbers.size()>0) { if(it!=sameNumbers.end()) { if(sameNumbers.find(data)->first==data) { sameNumbers.find(data)->second=sameNumbers.find(data)->second++; } } else { sameNumbers.insert(pair<int,int>(data,1)); } } else { sameNumbers.insert(pair< int,int>(data,1)); } createTree(rootNode,data); } { showTree(rootNode); void showMap(); }; void BinaryTree::createTree(TreeNode*& root,int data){ //check if root is NULL, this is called recursively for left or right side,for every new node if(root= =NULL) { root=new TreeNode(data); root->leftNode=N ULL; root->rightNode=NULL; return; } if(root->data<da ta) { createTree(root->leftNode,data); ee(root->rightNode,data); }} } else { createTr //show tree } void BinaryTree::show()

void BinaryTree::showTree(TreeNode*& root){ //check if root is NULL, this is called recursively for left or right side,for every new node if(root==NULL) { return; } showTree(root->leftNode); cout<<root->data <<endl; showTree(root->rightNode);} void BinaryTree::showMap(){ cout<<endl; int min=sameNumbers.begin()->sec ond; int key=sameNumbers.begin()->first; for(map<int,int>::iterator it1=s ameNumbers.begin();it1!=sameNumbers.end();++it1) { cout<<it 1->first<<" "<<it1->second<<endl; int key; if(min>i t1->second) { min=it1->second; key=it1->first; } } cout<<"number with minmum count"<<min<<" is"<<key;} int main(){ BinaryTree tree; tree.insert(2); tree.insert(3); tree.ins ert(4); tree.insert(2); tree.insert(3); tree.insert(3); tree.insert(4); tree.ins ert(4); tree.show(); tree.showMap(); getchar(); } 6) Here is my implementation for this problem: basicalgos.blogspot.com/2012/03/34-find-outlier-pattern-in-array.html return 0;}

S-ar putea să vă placă și