MY mENU


Thursday, 22 March 2012

What does the #include directive do?

The #include directive is used to include header files that contain the declarations to the functions used in your C program. In other words, the #include directive tells the C preprocessor to look into the include path to find the specified header file.

Why is the main() function needed in a C program?

The execution of a C program starts and ends with the main() function. Without the main() function, the computer does not know where to start to run a program.

What is the difference between the Heap and the Stack?

The main difference b/n the Heap and the Stack are given below:

- In stack we create object temporary where programmer used to reserve allocation.'
- stack not have automatic garbage collection where as heap have automatic garbage collection.

Why n++ executes faster than n+1?

n++ executes faster than n+1 because n++ want only one instruction for execution where n+1 want more one instruction for execution.

How the processor registers can be used in C?

using keyword register we can use the process register in C. Basically process register is used to store variables those i want to access frequently. if these registers are not used in any other program, then those registers we used to allocate memory these variables.

What are the stream files in C?

We can open file in C with using stream files.which are identified with a pointer to a FILE structure, or as low-level files, which are identified with an integer handle.

We can open stream files with using one of the following functions.

fopen(): Opens the specified file with the specified mode

freopen(): Closes the file specified, then opens a new file as specified

fdopen(): Opens a duplicate stream file for an already open low-lev

Is C is platform dependent or independent?

Major issue behind designing C language is that it is a small,portable programming language. It is used to implement an operating system.In past time C is a powerful tool for writing all types of program and has mechanism to achieve all most programming goals.So, we can say that C is platform dependent.

Famous Personalities who failed at first

Business Gurus

1. Henry Ford
Ford is known for his innovative success but he failed five times before he founded the FORD Company.

2. R. H. Macy
Before the success of MACY, he failed in seven businesses and finally succeeded with his new store.

3. Soichiro Honda
The billion-dollar business, that is Honda, started initially with a series of failures. He started making scooters of his own at home and spurred on by his neighbors, finally started his own business.

4. Bill Gates
Gates didn't seem like a shoe-in for success after dropping out of Harvard and starting a failed first business with Microsoft co-founder Paul Allen called Traf-O-Data.

5. Harland David Sanders
Sanders founded KFC and his famous secret chicken recipe was rejected 1,009 times before a restaurant accepted it.

6. Walt Disney
Walt Disney had a bit of a rough start and he was fired by a newspaper editor because, 'he lacked imagination and had no good ideas'. He kept plugging along, however, and eventually found a recipe for success that worked.

Scientists

7. Albert Einstein
Einstein did not speak until he was four and did not read until he was seven, and his teachers and parents thought he was mentally handicapped, slow and anti-social. But he caught on pretty well in the end, winning the Nobel Prize and changing the face of modern physics.

8. Charles Darwin
In his early years, Darwin gave up on having a medical career and considered as a lazy boy. Now, Darwin is well-known for his scientific studies.

9. Isaac Newton
Newton was failed so many times in his school days and was sent off to Cambridge where he finally blossomed into the scholar we know today.

10. Thomas Edison
Edison was fired for being unproductive In his early years. Even as an inventor, Edison made 1,000 unsuccessful attempts at inventing the light bulb.

11. Orville and Wilbur Wright
After numerous attempts at creating flying machines, several years of hard work, and tons of failed prototypes, the brothers finally created a plane.

Public Figures

12. Winston Churchill
This Nobel Prize-winning, twice-elected Prime Minster of the United Kingdom struggled in school and failed the sixth grade. After many years of political failures, finally became the Prime Minister at the ripe old age of 62.

13. Abraham Lincoln
After Lincoln was failed many times in business and defeated in numerous runs, he became a greatest leader.

14. Oprah Winfrey
Oprah faced a rough and abusive childhood as well as numerous career setbacks in her life to become one of the most iconic faces on TV.

Writers and Artists

15. Steven Spielberg
Spielberg's name was rejected from the University of Southern California School of Theater, Film and Television three times. Thirty-five years after starting his degree, Spielberg returned to school in 2002 to finally complete his work and earn his BA.

16. J. K. Rowling
Rowling may be rolling in a lot of Harry Potter dough today, but before she published the series of novels she was nearly penniless, severely depressed, divorced, trying to raise a child on her own while attending school and writing a novel.

Athletes

17. Michael Jordan
Most people wouldn't believe that a man often lauded as the best basketball player of all time was actually cut from his high school basketball team. 'I have failed over and over and over again in my life. And that is why I succeed.'

Jsp Interview Questions-part4

What is the difference between ServletContext and PageContext?

ServletContext: Gives the information about the container and it represents an application. PageContext: Gives the information about the Request and it can provide all other implicit JSP objects .


Is there a way to reference the "this" variable within a JSP page? 

Yes, there is. The page implicit object is equivalent to "this", and returns a reference to the generated servlet. 

Can you make use of a ServletOutputStream object from within a JSP page? 
Yes . By using getOutputStream() method on response implicit object we can get it.

What is the page directive is used to prevent a JSP page from automatically creating a session? 
session object is by default available to the JSP. We can make it unavailable by using page directive as follows.
<%@ page session="false"> 

 What's a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization? 
            Synchronized keyword is recommended to use to get thread-safety.

How does JSP handle run-time exceptions?

You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page.

For example: 

<%@ page errorPage="error.jsp" %> 

redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive:

<%@ page isErrorPage="true" %>

In the error pages we can access exception implicit object.

How is scripting disabled in Jsp

Scripting is disabled by setting the scripting-invalid element of the deployment descriptor to true. It is a subelement of jsp-property-group. Its valid values are true and false. The syntax for disabling scripting is as follows


The JSP implicit objects


Implicit objects are by default available to the JSP. Being JSP author we can use these and not required to create it explicitly.
  1. request
  2. response
  3. pageContext
  4. session
  5. application
  6. out
  7. config
  8. page
  9. exception