Thursday, 21 September 2017

interview questions part 2

What is Text Formatting?
Ans. Text formatting refers to the attributes of text other than the actual text itself. For example: bold, italics, underlining, color, and size, are all formatting attributes of text. The location of text can also be considered part of the formatting. Text can be automatically centered, indented, or positioned in other ways. When you wish to change the format of text, you usually have to select the text, then do the formatting by clicking the appropriate buttons. Occasionally, there are exceptions to the select-then-do paradigm. In Microsoft Word, there is a feature called Format Painter with which you click some already formatted text, then click the Format Painter toolbar button, then drag the mouse cursor across some other text. The other text will be "painted" with the formatting of the original text selected. If you double-click the Format Painter button, then it will be "locked" and you can paint lots of text. When you are done, click the Format Painter button again to turn it off.

What are Kilobyte, Megabyte, Gigabyte ... etc?
Ans.
Kilobyte: A Kilobyte is approximately 1,000 Bytes, actually 1,024 Bytes depending on which definition is used. 1 Kilobyte would be equal to this paragraph you are reading, whereas 100 Kilobytes would equal an entire page.
Megabyte: A Megabyte is approximately 1,000 Kilobytes. In the early days of computing, a Megabyte was considered to be a large amount of data. These days with a 500 Gigabyte hard drive on a computer being common, a Megabyte doesn't seem like much anymore. One of those old 3-1/2 inch floppy disks can hold 1.44 Megabytes or the equivalent of a small book. 100 Megabytes might hold a couple volumes of Encyclopedias. 600 Megabytes is about the amount of data that will fit on a CD-ROM disk.

Gigabyte: A Gigabyte is approximately 1,000 Megabytes. A Gigabyte is still a very common term used these days when referring to disk space or drive storage. 1 Gigabyte of data is almost twice the amount of data that a CD-ROM can hold. But it's about one thousand times the capacity of a 3-1/2 floppy disk. 1 Gigabyte could hold the contents of about 10 yards of books on a shelf. 100 Gigabytes could hold the entire library floor of academic journals.
Terabyte: A Terabyte is approximately one trillion bytes, or 1,000 Gigabytes. There was a time that I never thought I would see a 1 Terabyte hard drive, now one and two terabyte drives are the normal specs for many new computers.  To put it in some perspective, a Terabyte could hold about 3.6 million 300 Kilobyte images or maybe about 300 hours of good quality video. A Terabyte could hold 1,000 copies of the Encyclopedia Britannica. Ten Terabytes could hold the printed collection of the Library of Congress. That's a lot of data.
Petabyte: A Petabyte is approximately 1,000 Terabytes or one million Gigabytes. It's hard to visualize what a Petabyte could hold. 1 Petabyte could hold approximately 20 million 4-door filing cabinets full of text. It could hold 500 billion pages of standard printed text. It would take about 500 million floppy disks to store the same amount of data.
Exabyte: An Exabyte is approximately 1,000 Petabytes. Another way to look at it is that an Exabyte is approximately one quintillion bytes or one billion Gigabytes. There is not much to compare an Exabyte to. It has been said that 5 Exabytes would be equal to all of the words ever spoken by mankind.
Zettabyte: A Zettabyte is approximately 1,000 Exabytes. There is nothing to compare a Zettabyte to but to say that it would take a whole lot of ones and zeroes to fill it up.
Yottabyte: A Yottabyte is approximately 1,000 Zettabytes. It would take approximately 11 trillion years to download a Yottabyte file from the Internet using high-power broadband. You can compare it to the World Wide Web as the entire Internet almost takes up about a Yottabyte.
Brontobyte: A Brontobyte is (you guessed it) approximately 1,000 Yottabytes. The only thing there is to say about a Brontobyte is that it is a 1 followed by 27 zeroes!
Geopbyte: A Geopbyte is about 1000 Brontobytes! Not sure why this term was created. I'm doubting that anyone alive today will ever see a Geopbyte hard drive. One way of looking at a geopbyte is 15267 6504600 2283229 4012496 7031205 376 bytes!

 What is the difference between Save and Save As?
Ans.
  • Use SAVE when you are updating an existing document.
  • Use SAVE AS when you are creating a new document from scratch or an existing document. If you do for existing document, this will keep the original document untouched in its original format and create a new document with a new name with updated data.
Example: Open Notepad -> Type something -> Click on File -> Save As. It will save the file by asking file name (sample.txt). If you want to update the file use File -> Save. If you want another file name with (sample.txt file data + added some another data), use Save As. Here sample.txt will be untouched and new file will contain updated data.


. How can we find out basic information (Operation System, RAM, CPU, Drivers etc.) about our computer?
Ans.
We can get the basic information about our computer by following below steps:
  • Right Click at my computer icon.
  • Click Properties.
  • General tab will show the processor and ram information
  • And Hardware Tab -> Device Manger will show the entire hardware resources attached with you computer


Java
. How could Java classes direct program messages to the system console, but error messages, say to a file?
Ans. By default, both System console and err point at the system console.
The class System has a variable out that represents the standard output.
The variable err that represents the standard error device. 

What are the differences between an interface and an abstract class?
Ans.
  • An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
  • can be implemented by classes that are not related to one another and there is "HAS-A" relationship. 
  • You cannot extend more than one abstract class. You can implement more than one interface. 
  • Abstract class can implemented some methods also. Interfaces can not implement methods. 
  • With abstract classes, you are grabbing away each class’s individuality. With Interfaces, you are merely extending each class’s functionality.
Why would you use a synchronized block vs. synchronized method?
Ans.
  •  blocks place locks for shorter periods than synchronized methods.
  • If you go for synchronized block it will lock a specific object. 
  • If you go for synchronized method it will lock all the objects. 
  • In other way Both the synchronized method and block are used to acquires the lock for an object. But the context may vary. Suppose if we want to invoke a critical method which is in a class whose access is not available then synchronized block is used. Otherwise synchronized method can be used. 
  • Synchronized methods are used when we are sure all instance will work on the same set of data through the same function Synchronized block is used when we use code which we cannot modify ourselves like third party jars etc.
 How can you force garbage collection?
Ans. You can't force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.

The following code of program will help you in forcing the garbage collection. First of all we have created an object for the garbage collector to perform some operation. Then we have used the System.gc(); method to force the garbage collection on that object. Then we have used the System.currentTimeMillis(); method to show the time take by the garbage collector.
How do you know if an explicit object casting is needed?
Ans. If you assign a superclass object to a variable of a subclass's data type, you need to do explicit casting. For example:
What is the difference between constructors and other methods in core java?
Ans.

  •  
  •  needs to have the same name as that of the class whereas functions need not be the same.
  • There is no return type given in a constructor signature (header). The value is this object itself so there is no need to indicate a return value.
  • There is no return statement in the body of the constructor.
  • The first line of a constructor must either be a call on another constructor in the same class (), or a call on the superclass constructor). If the first line is neither of these, the compiler automatically inserts a call to the parameterless super class constructor.

No comments:

Post a Comment

resume format

क्या है डिजिटल अरेस्ट, साइबर फ्रॉड का नया तरीका, जानिए ये कैसा होता है

  क्या है डिजिटल अरेस्ट? डिजिटल अरेस्ट में किसी शख्स को ऑनलाइन माध्यम से डराया जाता है कि वह सरकारी एजेंसी के माध्यम से अरेस्ट हो गया है, उस...