Friday 19 October 2018

Practice Programming Question In JAVA (Part 2)




Hey,

Here are some logical programming question that may ask in viva or an interview. Don't by heart (mug up) these programs to try to do it by your self.
If you find any difficulty to solve these programs please comment on this post I will mail you the solutions.


# Some Logical Programs


Ques 1 - WAP of Fibonacci sequence, ask a number from user and print n terms of that Fibonacci Series.


Ques 2 - WAP to generate TABLE in proper formate

  • if the number is negative --- o/p will be a negative number
  • if the number is positive --- o/p will be table generate 
  • if the number is string --- o/p will be enter number only.


Ques 3 - WAP to generate Factorial 
  1. With recursion 
  2. Without recursion


Ques 4 - WAP to print your name 100 times without using a loop. [Hint - using recusion]


Ques 5 - WAP to find the factorial of a given number n.
  1. With recursion 
  2. Without recursion


Ques 6 - WAP to find the prime number from 2 to n (n is input from the user).



# Some Array Question


Ques 7 -  arr[25] = { 1,5,8,7,19,14,5,7,2,12,31,78,3,2,4,19,17,8,5,77,9,19.45,54,20 }
  1. Find the duplicates in given array?
  2. Sort the array 
    1. Ascending order
    2. Descending order
  3. Sort the array and display only alternate elements in the array.
  4. Find the second largest and second smallest element in the array.
  5. Find the sum of elements in the array
    1. Including Duplicate elements 
    2. Excluding Duplicate elements(add once)




No comments:

Post a Comment