Hello lovely people, I understand your struggle of going through these hectic interviews that’s why I have come up with some important interview questions in this post. After going through all these questions you will get a understanding about the level of questions in interview.
Important Interview Questions for Hewlett Packard (HP)
These questions are assembled here for you after due research by our research team to provide you maximum value. Go through this post till the end.
Question 1. What is the purpose of CloneMenu()?
Answer. CloneMenu() method copies the whole list of MenuItem objects into the current menu.
– It accepts a parameter of the type menu.
– It can be used in a derived class to clone MenuItem objects.
– They can then be reused by other classes that derive from the menu.
– It creates a copy of a MenuItem.
– This method can be called without arguments to create a duplicate copy of the MainMenu object.
– This method keeps all the event handlers intact, and is useful when you need to reuse the same entries in a context menu as in a main menu.
CloneMenu overload list:
- CloneMenu(): It creates a copy of the current MenuItem.
- CloneMenu(): It copies the menu that is passed as a parameter to the current menu.
- CloneMenu(MenuItem): It creates a copy of the specified MenuItem.
Question 2. What is constant in C?
Answer. Constants refer to fixed values. They are also called as literals.
C Constants are also like normal variables. But, only difference is, constant values can’t be modified by the program once they are defined. Constants may be belonging to any of the data type.
Question 3. Explain how to dynamically clone a menu in .NET.
Answer. Follow the steps below to dynamically clone a menu in .NET:
– Create an alternate MainMenu object.
– Clone the first menu with the CloneMenu method.
– Create additional menu items related to the application state.
– Then add the new menu items to the MenuItems collection of the top-level menu item cloned. This can be done by using the Add method to specify their order within the collection by their index.
– Assign the newly-created MainMenu object to the form.
Question 4. What is variable in C?
Answer. C variable is a named location in a memory where a program can manipulate the data. This location is used to hold the value of the variable.
The value of the C variable may get change in the program.
C variable might be belonging to any of the data type like int, float, char etc.
Question 5. Is it possible to force garbage collection to run?
Answer. Yes, it is possible to force Garbage Collection.
– The way to do it is by using GC.Collect().
– However, it is also necessary to run the finalizers of the objects that need to be deallocated. So, it is necessary to use GC.WaitForPendingFinalizers() along with GC.Collect() so that the finalizers threads are not executed separately.
– The GC class provides the GC.Collect() method, which you can use to give your application some direct control over the garbage collector.
– You can force object finalization to occur by calling System’s runFinalization method.
Question 6. Can variable name start with numbers?
Answer. No. Variable names can’t start with numbers as per the variable naming rule.
Question 7. Explain how garbage collection manages reclamation of unused memory in .NET.
Answer. CLR performs garbage collection on small objects and large objects separately. It maintains separate heaps for these two types of objects. Large Objects are maintained in LO
Heap and small objects are kept in multiple heaps which are compacted regularly.
It uses the JIT compiler which provides it the references of live objects indicating that they are alive. The rest of the objects are then subject to garbage collection.
Then the free memory is merged and the occupied memory is compacted so that the live objects are contiguous.
Question 8. What are the different types of variable in C?
Answer. Local variable
Question 9. What is break mode? What are the options to step through code?
Answer. Break mode lets you to observe code line to line in order to locate error.
VS.NET provides following option to step through code.
– Step Into
– Step Over
– Step Out
– Run To Cursor
– Set Next Statement
Question 10. What is global variable in C?
Answer. The variables which are having scope/life throughout the program are called global variables.
Global variable is defined outside the main function. So, this variable is visible to main function and all other sub functions.
Question 11. Define Listeners collection of Trace and Debug objects.
Answer. The Trace and Debug objects contain a Listeners collection.
These Listeners collection collect output from the trace statements.
There are three types of predefined listeners:
DefaultTraceListener: This is default listener and writes trace statements in the Output window.
TextWriterTraceListener: can write output to the text file or to the console window.
EventLogTraceListener: can write messages to the Event Log.
Question 12. What is operator in C?
Answer. The symbols which are used to perform logical and mathematical operations in a C program are called C operators.
These C operators join individual constants and variables to form expressions. Operators, functions, constants and variables are combined together to form expressions.
Question 13. What are Trace switches?
Answer. Trace switches are used to enable, disable and filter the tracing output. They are objects can be configured through the .config file.
Question 14. What is the syntax for ternary operator in C?
Answer. Ternary operator is same as if else control statement in C.
Syntax : (Condition? true_value: false_value);
Example: (A > 100? 0: 1);
Question 15. Explain how to create a read-only or write-only property.
Answer. You can either use fields or property procedure to add properties.
To create a property that can only be read and not altered, you need to declare it as ReadOnly. After doing this, if you try to assign value to the property, an error will occur.
The next step is to write a get procedure to retrieve the value contained by the variable.
Nb: The set procedure should not be written in this case.
To create a WriteOnly property like in case of passwords, you need to declare it as WriteOnly. Then, this value cannot be used for reading purposes. After the declaration, you need to write only a set procedure without writing a get to be able to just set the value of the variable
Question 16. What is assignment operator in C?
Answer. Assignment operators are used to assign the values to the variables.
Assignment operators are =, +=, -=, /+, %= etc.
Question 17. What is manifest?
Answer. Manifest describes the relationship and dependencies of the components in the assembly.
– The versioning information, scope information and the security permissions are required by the assembly.
-An Assembly data like version, scope, security information (strong name),etc. is stored in manifest.
-The manifest also contains a reference to the resource and classes.
-The manifest of an assembly is stored in either an .exe or a .dll with Microsoft intermediate language (MSIL) code.
-This file contains metadata about .NET assemblies.
-It contains a collection of data that describes how the elements in the assembly relate to each other.
Question 18. What is the logical operator in C?
Answer. Logical operators are used to perform logical operations on the given expressions.
There are 3 logical operators in C language. They are,
logical AND (&&)
logical OR (||)
logical NOT (!)
Question 19. Explain the different types of assemblies in .NET, i.e. Static and dynamic assemblies, Private and Shared assemblies, Single-file and Multiple-file assemblies.
Answer. Static assemblies contain interfaces, classes, resources, etc for the assembly and are stored on disk in portable executable (PE) files.
Dynamic assemblies execute directly from the memory and can be saved to the disk only after their execution.
A private assembly is the one that is available for the exclusively for an application.
A shared assembly can be shared by multiple applications.
Multiple file assemblies are contained in multiple files and are linked through the assembly manifest. The CLR manages them as a unit. A single file assembly is not split across multiple files.
Question 20. What are all decision control statements in C?
Answer. There are 3 types of decision making control statements in C language. They are,
if else statements
nested if statements
We have given some very important questions of Interview above. If you have still any queries then you can comment below. We here at Alpigni are always happy to help you.