Skip to main content

Posts

Showing posts from July, 2021

Quiz based on Digital Principles and Computer Organization

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)...

Java important question - 4

1) What is anonymous inner class ?           A local inner class without name is known as anonymous inner class. An anonymous class is defined and instantiated in a single statement. Anonymous inner class always extend a class or implement an interface.           Since an anonymous class has no name, it is not possible to define a constructor for an anonymous class. Anonymous inner classes are accessible only at the point where it is defined. 2) What is the difference between == and .equals() method in Java?           In general both equals() and "==" operator in java are used to compare objects to check equality but here are some of the difference between the two: 1) Main difference between . equals() method and == operator is that one is method and other is operator. 2) We can use == operators for reference comparison and .equals() method for content comparison. In simple words, == checks if both objects point ...

Java Important questions - 3

1) Name the methods of Object class? clone() - This method helps to create and return a copy of the object. equals() - This method helps to compare. finalize () - called by the garbage collector on an object. getclass() - It helps to return the runtime class of an object. hashcode() - Helps to return a hash code value for the object toString() - helps to return a string representation of the object. notify(), notifyAll() and wait() - It helps to synchronize the activities of independently running threads in a program. 2) What are constructors in java? What are the types of constructors?           In java, the constructor is a block of code used to initialize an object. The constructor is a method which has the same name as class name. There are two types of constructors: 1. Default constructor :           A constructor that has no parameters is known as default constructor. If we don't define a constructor in a class, the compiler...

Class in java

Define class in Java           In java, a class is a template used to create object and define the data type. It acts as a building block for java language oriented systems. All java codes are defined in a class. A class has variables and methods.           Variables are attributes which define the state of class.           Methods are the place where the exact business logic has to be done. It contains a set of statements or instructions to satisfy the particular requirement. Eg:  public class Addition // class name declaration { int a= 5; // variable declaration int b= 5;  public void add() { // Method declaration int c=a+b; } } What do you mean by object ?           Object is a basic unit of  Object oriented programming and represents the real life entities. A typical java program creates many objects, which interact each other by invoking methods. A java object is a com...

Main method in Java

What is main method in Java?           Main method in Java is an standard method which is used by JVM to start execution of any java program. Main method is referred as entry point of any standalone java application.           Main method in Java is public so that it's visible to every other class, even which are not part of it's package. If it is not public, JVM class might not able to access it.           Main method is static so that java runtime can access it without initializing the class. While JVM tried to execute java program, it doesn't know how to create instance of main class as there is no standard constructor is defined for main class.           Main method is void in Java because it doesn't return anything to caller which is JVM. Signature of main method:           main method is public, static and void and accept an array of String as argument throu...

Java Important Questions - 2

1) Does Java uses pointers?          No, java doesn't use Pointers. Carelessness in their use may result in memory problems. Also it has tough security. Instead of Pointers, reference are used in java as they are safer and more secure when compared to a Pointer. 2) How are Destructors defined in java?           Since, java has it's own garbage collection, no destructors are required to be defined. Destruction of objects is automatically carried by the garbage collection mechanism. 3) What is the difference between path and classpath variable?           PATH is an environment variable used by operating system to locate the executables. Once you installed java on your machine, it is required to set the PATH environment variable to run conveniently run the executables (javac.exe, java.exe, javadoc.exe,and so on) from any directory without having to type the full path of the command,such as: c:\javac Testclass.java O...

Difference between JDK, JRE and JVM

Difference between JDK,JRE and JVM           JDK, JRE and JVM are core concepts of java programming language. Although they all look similar and as a programmer we don't care about this concepts a lot, but they are different and meant for specific purpose. JDK           Java development kit is the core component of java environment and provides all the tools, executables and binaries required to compile, debug and execute a java program. JDK is a platform specific software and thats why we have separate installers for Windows, Mac and Unix system. We can say that JDK is superset of JRE. Since it contains JRE with java compiler, debugger and core classes. Current version of JDK is 16 also known as java 16. JVM            JVM is the heart of java programming language. when we run a program, JVM is responsible to converting Byte code to the machine specific code. JVM is also platform dependent and provides core...

Java Questions and Answers - 1

1) What do you mean by platform independent in java?           Platform independence means that you can run the same java program in any Operating system. For example, you can write java program in window and run it in Mac OS. 2) What is JVM and is it platform independent ?           Java virtual machine (JVM )  is the heart of java programming language. JVM is responsible for converting byte code into machine readable code. JVM is not platform independent, that's why you have different JVM for different operating system. We can customize JVM with java options, such as minimum and maximum memory to JVM. It is called virtual because it provides an interface that doesn't depend on the underlying OS. 3) Java compiler is stored in JDK, JRE or JVM ?           The task of java compiler is to convert java program into byte code, we have javac executeable for that. So it must be stored in JDK, we don't need it in JR...