Computer Programming Interview Questions & Answers

5 avg. rating (100% score) - 1 votes

Computer Programming Interview Questions & Answers

Are you an expertise in computer programming languages? Do you have excellent knowledge in coding? Then computer programming is the right choice for you where you can develop as a computer programmer. wisdom jobs have gathered all the information about the course, skills required, training courses and the availability of jobs. In Computer programming a set of instructions is being given in the form of code language by which the computer can understands and complies to perform a particular task or sorting out the problem. As a Computer programmer you need to write programs that maintain and control computer networks, databases or operating systems. So, to get the job easily in multinational firms our site wisdom jobs have provided you with the computer programming job interview questions and answers that ensures you to clear the interview and land at your dream job.

Computer Programming Interview Questions

Computer Programming Interview Questions
    1. Question 1. What Is Reflection?

      Answer :

      The process of obtaining information about assemblies and the types defined within them, and creating, invoking, and accessing type instances at run time.

      Reflection provides objects that describe assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, Reflection enables you to access them.

      Reflection provides infrastructure used by language compilers to implement implicit late binding.

      Reflection allows known data types to be inspected at runtime. Reflection allows the enumeration of data types in a given assembly, and the members of a given class or value type can be discovered. This is true regardless of whether the type was known or referenced at compile time. This makes reflection a useful feature for development and code management tools.

    2. Question 2. When Reflection Is Useful?

      Answer :

      Reflection is useful in the following situations:

      • When you have to access attributes in your program's metadata.
      • For examining and instantiating types in an assembly.
      • For building new types at runtime. Use classes in System.Reflection. Emit.
      • For performing late binding, accessing methods on types created at run time.

    3. Question 3. What Is Late Binding?

      Answer :

      Binding is the process of locating the declaration that corresponds to a uniquely specified type. When this process occurs at run time rather than at compile time, it is called late binding.

    4. Question 4. What Is Custom Binding?

      Answer :

      The common language runtime supports multiple programming languages, and the binding rules of these languages differ. In the early-bound case, code generators can completely control this binding. However, in late binding through reflection, binding must be controlled by customized binding. The Binder class provides custom control of member selection and invocation.

      Using custom binding, you can load an assembly at run time, obtain information about types in that assembly, specify the type that you want, and then invoke methods or access fields or properties on that type. This technique is useful if you do not know an object's type at compile time, such as when the object type is dependent on user input.

    5. Question 5. Which Class Has Significant Importance For Reflection?

      Answer :

      The System. Type class is central to reflection. The common language runtime creates the Type for a loaded type when reflection requests it. You can use a Type object's methods, fields, properties, and nested classes to find out everything about that type.

    6. Question 6. How Do You Get Type Objects From Assemblies That Have Not Been Loaded?

      Answer :

      Use Assembly.GetType or Assembly.GetType to obtain Type objects from assemblies that have not been loaded, passing in the name of the type or types you want.

    7. Question 7. How Do You Get To Type Objects From An Assembly That Is Already Loaded?

      Answer :

      Use Type.GetType to get the Type objects from an assembly that is already loaded Use Type. Get Type to get the Type objects from an assembly that is already loaded.

    8. Question 8. How Do You Obtain Module Type Objects?

      Answer :

      Use Module.GetType and Module.GetType to obtain module Type objects.

    9. Question 9. Which Property Is Used To Determine Whether The Type Is Generic?

      Answer :

      Use the IsGenericType property to determine whether the type is generic, and use the IsGenericTypeDefinition property to determine whether the type is a generic type definition.

    10. Question 10. Which Name Space Contains The Classes That Are Used To Enables You To Build Types At Run Time?

      Answer :

      System.Reflection. Emit

    11. Question 11. What Is The Use Of System.reflection Namespace?

      Answer :

      The System.Reflection namespace contains types that retrieve information about assemblies, modules, members, parameters, and other entities in managed code by examining their metadata. These types also can be used to manipulate instances of loaded types, for example to hook up events or to invoke methods.

    12. Question 12. Is It Good To Use Reflection In An Application? Why?

      Answer :

      No, It's like challenging the design of application.

    13. Question 13. What Is Performing Java.lang. Class Class?

      Answer :

      The java.lang. Class class performs mainly two tasks: 

      • Provides methods to get the metadata of a class at run time.
      • Provides methods to examine and change the run time behavior of a class.

    14. Question 14. Why Is Reflection Slower?

      Answer :

      Because it has to inspect the metadata in the Bytecode instead of just using pre compiled addresses and constants.

    15. Question 15. What Is Java Reflection Api?

      Answer :

      • Java Reflection is a process of examining or modifying the run time behavior of a class at run time. 
      • The java.lang. Class class provides many methods that can be used to get metadata examine and change the run time behavior of a class. 
      • The java.lang and java.lang. Reflect packages provide classes for java reflection.

    16. Question 16. How To Get The Object Of Class Class?

      Answer :

      There are 3 ways to get the instance of Class class.

      They are as follows: 

      • forName() method of Class class
      • getClass () method of Object class
      • the .class syntax

    17. Question 17. Determining The Class Object?

      Answer :

      Following methods of Class class is used to determine the class object: 

      1. Public Boolean is Interface (): determines if the specified Class object represents an interface type. 
      2. Public Boolean isArray (): determines if this Class object represents an array class. 
      3. Public Boolean is Primitive (): determines if the specified Class object represents a primitive type. 

      Let's see the simple example of reflection api to determine the object type.

      class Simple{}

      interface My{}

      class Test{

      public static void main(String args[]){

      try{

      Class c=Class.forName("Simple");

      System.out.println(c.is Interface());

      Class c2=Class.forName("My");

      System.out.println(c2.is Interface());

      }catch(Exception e){System.out.println(e);}

      }

      }

      Output:

      false

      true

    18. Question 18. For Name () Method Of Class Class?

      Answer :

      • is used to load the class dynamically.
      • returns the instance of Class class.
      • It should be used if you know the fully qualified name of class. This cannot be used for primitive types. 

      Let's see the simple example of forName () method.

      class Simple{}

      class Test{

      public static void main(String args[]){

      Class c=Class.forName("Simple");

      System.out.println(c.getName());

      }

      }

      Output: Simple

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Computer Programming Tutorial