1) Base of hexadecimal number system? Answer : 16 2) Universal gate in digital logic? Answer : NAND 3) Memory type that is non-volatile? Answer : ROM 4) Basic building block of digital circuits? Answer : Gate 5) Device used for data storage in sequential circuits? Answer : Flip-flop 6) Architecture with shared memory for instructions and data? Answer : von Neumann 7) The smallest unit of data in computing? Answer : Bit 8) Unit that performs arithmetic operations in a CPU? Answer : ALU 9) Memory faster than main memory but smaller in size? Answer : Cache 10) System cycle that includes fetch, decode, and execute? Answer : Instruction 11) Type of circuit where output depends on present input only? Answer : Combinational 12) The binary equivalent of decimal 10? Answer : 1010 13) Memory used for high-speed temporary storage in a CPU? Answer : Register 14) Method of representing negative numbers in binary? Answer : Two's complement 15) Gate that inverts its input signal? Answer : NOT 16)...
What are the ways to initialize a final variable ?
We must initialize a final variable, otherwise compiler will throw compile time error. A final variable can only be initialize once, either via an initializer or an assignment statement. There are three ways to initialize a final variable,
1) You can initialize a final variable when it is declared. This approach is most common. A final variable is called blank final variable, if it is not initialized while declaration. Below are the two ways to initialize a blank final variable.
2) A blank final variable can be initialized inside constructor. If you have more than one constructor in your class then it must be initialized in all of them, otherwise compile time error will be thrown.
3) A blank final static variable can be initialized inside static block.
What is the difference between transient and volatile variable in Java ?
Transient:
In Java, it is used to specify the variable is not being serialized. Serialization is the process of saving an object's state in Java. When we want to persist the object's state by default, all instance variables in the object are stored. In some cases, if we want to avoid persisting few variables, declare those variables as transient. If the variable is confirmed as transient, then it will not be persisted. Transient keyword is used with that instance variable which will not participate in the serialization process.
Volatile :
Volatile modifier tells the compiler that the variable modified by volatile can be changed expectedly by other parts of the program, so writes to the field should always be synchronously flushed to memory, and that reads of the field should always read from memory. Any threads using that variable are not allowed to cache that value at all. This means that fields marked as volatile can be safely acrossed and updated in a multithread application without using native or standard library-based synchronization.