Most asked Programming Interview Questions

Frenzz the following programs are very interesting. Try to find the output of these programs and write your answers in comments.Hope these will be very useful at the time of interviews.


Program 1: This is most frequently asked C program in interviews.


Very Frequently asked c program











Output:

Output of C program



Explanation:

Here variables a and b holds characters '9' and '8' whose ASCII values are 57 and 56 respectively.So while performing addition ASCII values of the characters are added and the result will be stored in variable c. Now ASCII value of character stored in variable c is 57+56=113 and the respective character is 'q'.

Program to know ASCII value of any character: (Click Here)


Program 2: This is Very Interesting Java program





















Output:




Explanation:

Rule: 

"Whenever there are multiple catch blocks  for a try block then the catch blocks should be ordered from most specific to most generic exceptions."

 Above program results a compilation error because it violates the above rule.In this program ArithmeticException is specific exception and Exception is the generic one. But Exception is caught first which leads to compilation error.


Program 3:This is a java Program of level 1 interview

























Output:





Explanation:

   We can assign names to the blocks. Here the two for loops are named with the labels "outer" and "inner".So first time when it enters into outer for loop it will enters into inner for loop and prints "Am ok" then break statement breaks outer for loop.So control will exit from the outer for loop.


Some more interesting programs will be updated soon.Link:- (Click Here)
Share on Google Plus
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment