Wednesday, 29 February 2012
What is the difference between text and binary modes?
Tuesday, 28 February 2012
Sun Certified Java Programmer (SCJP) Questions
Which is the most suitable Java collection class for storing various companies and their stock prices? It is required that the class should support synchronization inherently.
Choices:
- A. Hashtable
- B. HashMap
- C. LinkedHashMap
- D. HashSet
- E. TreeMap
Correct choice:
- A
Explanation:
Monday, 27 February 2012
Types of External Memory
- Magnetic Disk
— RAID
— Removable
- Optical
— CD-ROM
— CD-Recordable (CD-R)
— CD-R/W
— DVD
- Magnetic Tape
Magnetic Disk
- Disk substrate coated with magnetizable material (iron
Sunday, 26 February 2012
What are the different phase/steps of acquiring a proxy object in Webservice ?
- Client communicates to UDI node for WebService either through browser or UDDI's public web service.
- UDII responds with a list of webservice.
- Every service listed by webservice has a URI pointing to DISCO or WSDL document.
Saturday, 25 February 2012
Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 11
Predict the output or error(s) for the following:
1)
main()
{
int k=1;
printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE");
}
Answer:
1==1 is TRUE
Explanation:
Friday, 24 February 2012
How can you restore a redirected standard stream?
The dup() function duplicates a file handle. You can use the dup() function to save the file handle corresponding to the stdout standard
Thursday, 23 February 2012
The Collections framework
List classes
A List is an ordered collection, which allows positional access and search.
The classes implementing List are ordered by index position. An ArrayList enables fast iteration and constant speed positional access. A Vector is similar to ArrayList, only slower because it is synchronized. LinkedList allows fast insertion and deletion at the beginning or end. It is commonly used for implementing stacks and queues. For instance:
Wednesday, 22 February 2012
Virtual Memory
- Demand paging
— Do not require all pages of a process in memory
— Bring in pages as required
- Page fault
— Required page is not in memory
— Operating System must swap in required page
— May need to swap out a page to make space
Tuesday, 21 February 2012
What are the steps to create a webservice and consume it ?
Note :- For this question this post will make a attempt by creating a simple webservice and explaining steps to acheive it. A simple webservice will be created which takes two number and gives addition result of the two number. Definitely the interviewer will not expect such a detail answer but this book will explain you in detail so that you are on right track during interview.
This webservice will add two numbers and give to the calling client. All the below steps are according to VS2008 beta editor :-
- First create a website by clicking on File -- New WebSite.
Monday, 20 February 2012
Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 10
Predict the output or error(s) for the following:
1)
main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
}
Answer:
2 5 5
Explanation:
Sunday, 19 February 2012
If errno contains a nonzero number, is there an error?
Usually, the standard C library function you are calling returns with a return code which denotes that an error has occurred and that the
Friday, 17 February 2012
The Collections framework
Collections and collections interfaces
Collections are objects used to group together and manipulate multiple data elements. They can dynamically grow and shrink, which is their advantage over arrays. Collections provide methods to add objects to a collection, remove objects from it, check if an object is
Thursday, 16 February 2012
Replacement Algorithms
- Least Recently used (LRU)
- e.g. in 2 way set associative
- Which of the 2 block is lru?
- First in first out (FIFO)
- replace block that has been in cache longest
- Least frequently used (LFU)
Wednesday, 15 February 2012
What is a Web Service ?
Web Services uses Simple Object Access Protocol (SOAP) in order to expose the business functionality.SOAP defines a standardized format in XML which can be exchanged between two entities over
Tuesday, 14 February 2012
Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 9
Predict the output or error(s) for the following:
1)
main()
{
char *cptr,c;
void *vptr,v;
c=10; v=0;
cptr=&c; vptr=&v;
printf("%c%v",c,v);
}
Answer:
Compiler error (at line number 4): size of v is Unknown.
Explanation:
Monday, 13 February 2012
What is hashing?
The idea behind hashing is that some data either has no inherent ordering (such as images) or is expensive to compare (such as images). If the data has no inherent ordering, you can’t perform comparison searches. If the data is expensive to compare, the
How many objects will be eligible for garbage collection after line 7?
{
public static void main(String [] args)
{
Object a = new Integer(100); // Line1
Object b = new Long(100); // Line2
Object c = new String(“100″); // Line3
a = null; // Line4
a = c; // Line5
c = b; // Line6
b = a; // Line7
// Rest of the code here
}
}
Choices:
- A. 0
- B. 1
- C. 2
- D. 3
- E. Code does not compile
Correct choice:
- B
Explanation:
Sunday, 12 February 2012
Cache
Saturday, 11 February 2012
What will be the result of an attempt to compile and run the following program?
{
public static void main(String args[])
{
String s1 = "abc";
String s2 = "abc";
s1 += "xyz";
s2.concat("pqr");
s1.toUpperCase();
System.out.println(s1 + s2);
}
}
Choices:
- A. "abcxyzabc"
- B. "abcxyzabcpqr"
- C. "ABCXYZabcpqr"
- D. "ABCXYZabc"
- E. Code does not compile
Correct choice:
- A
Explanation:
Friday, 10 February 2012
What is marshaling and what are different kinds of marshaling ?
There are two ways to do marshaling :-
- Marshal-by-value (MBV) :- In this the object is serialized into the channel, and a copy of the object is created on the other side
Thursday, 9 February 2012
Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 8
Predict the output or error(s) for the following:
1)
int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
}
Answer:
Runtime error: Abnormal program termination.
assert failed (i<5), <file name>,<line number>
Explanation:
Wednesday, 8 February 2012
What is the quickest searching method to use?
A digital trie combines aspects of binary searching, radix searching, and hashing. The term “digital trie” refers to the data structure used to hold the items to be searched. It is a multilevel data structure that
Tuesday, 7 February 2012
Memory Hierarchy
- Registers
— In CPU
- Internal or Main memory
— May include one or more levels of cache
— “RAM”
- External memory
Monday, 6 February 2012
Wrapper classes
Integer i1 = new Integer(50);
Integer i2 = new Integer("50");
The Character class constructor takes a char type element as an
Sunday, 5 February 2012
Which config file has all the supported channels/protocol ?
Note :- Interviewer will not ask you to name all channels and
Saturday, 4 February 2012
Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 7
Predict the output or error(s) for the following:
1)
main ( )
{
static char *s[ ] = {“black”, “white”, “yellow”, “violet”};
char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
**++p;
printf(“%s”,*--*++p + 3);
}
Answer:
ck
Explanation:
Friday, 3 February 2012
What is the easiest searching method to use?
Following is the prototype for bsearch():
void *bsearch(const void *key, const void *buf, size_t num, size_t size, int (*comp)(const void *, const void *));
The bsearch() function performs a binary search on an array of sorted data elements. A binary search is another “divide and conquer” algorithm. The key is compared with the middle element of
Thursday, 2 February 2012
Read Only Memory (ROM)
- Permanent storage
— Nonvolatile
- Microprogramming (see later)
- Library subroutines
- Systems programs (BIOS)
- Function tables
Types of ROM
- Written during manufacture
— Very expensive for small runs
- Programmable (once)
Wednesday, 1 February 2012
String and StringBuffer
Immutability of String objects
As you know, Strings are objects in Java code. These objects, however, are immutable. That is, their value, once assigned, can never be changed. For instance:
String msg = "Hello";
msg += " World";
Here the original String "Hello" is not changed. Instead, a new String is created with the value "Hello World" and assigned to the variable