Explain static and dynamic memory allocation with an example each.
Correct Answer
When amount of memory to be allocated is known beforehand ie at the the time of compilation, it is known as Static Memory Allocation Once the memory is allocated statically, it cannot be deallocated during program run So it leads to wastage of storage space Example: int A[100]; When amount of memory to be allocated is not known beforehand, rather it is determined at the time of program run, it is called Dynamic Memory Allocation It leads to efficient utilization of storage space Example: cout << " Enter number of elements: "; cin >> N; int *A = new int[N]; // dynamic memory allocation
Technology problems
Search Results
1. What is the difference between Tags and HTML Elements ?
Correct Answer: * HTML elements communicate with the Browser how to represent the text * HTML elements become HTML tags when enclosed within the angular brackets as "<>"
2. How can you make sure the web application is fit for release ?
Correct Answer: 1 We can operate majority of test cases, but importantly we can make use testing techniques such as Pair-wise testing to reduce combinations, and/or model based testing to plan user journeys to ensure major functionality of web application works or not 2 We can also use analytics to get insight into what users do on the website, which page is most popular and which feature is most used by the users
3. What is the importance of finally block in exception handling ?
Correct Answer: A finally block will always be executed, whether or not an exception is actually thrown Even in the case where the catch statement is missing and an exception is thrown, the finally block will still be executed Last thing to mention is that the finally block is used to release resources like I/O buffers, database connections, etc
4. Should a main() method be compulsorily declared in all java classes?
Correct Answer: A static method cannot access non static variables or methods because static methods doesnt need the object to be accessed So if a static method has non static variables or non static methods which has instantiated variables they will no be intialized since the object is not created and this could result in an error
Correct Answer: String Args (String []) is an array of parameters of type String In Java, 'args' contains the supplied command-line arguments as an array of String objects In other words, if you run your program as 'java MyProgram Hello World' then 'args' will contain ["Hello", "World"] When a java class is executed from the console, the main method is what is called
8. The syntax of capture events method for document object is..
Correct Answer: The JIT compiler is an important element of CLR, which loads MSIL on target machines for execution The MSIL is stored in NET assemblies after the developer has compiled the code written in any NET-compliant programming language, such as Visual Basic and C# JIT compiler translates the MSIL code of an assembly and uses the CPU architecture of the target machine to execute a NET application It also stores the resulting native code so that it is accessible for subsequent calls If a code executing on a target machine calls a non-native method, the JIT compiler converts the MSIL of that method into native code JIT compiler also enforces type-safety in runtime environment of NET Framework It checks for the values that are passed to parameters of any method For example, the JIT compiler detects any event, if a user tries to assign a 32-bit value to a parameter that can only accept 8-bit value
10. Which of the following gives the memory address of the first element in array?