Menu
Topics Index
...
`

Intermediate Level Test 4 has these questions


Print Fibonacci Series

Write a program to print Fibonacci series with the given size.
Input (Integer) Printed Output
4 1,1,2,3,
7 1,1,2,3,5,8,13,
12 1,1,2,3,5,8,13,21,34,55,89,144,
class PrintFibanocciSeries

{    public static void main(String s[])
    {
        fibanocciSeries(7);

    }


public static void fibanocciSeries(int size)
{
//Write code here to print Fibanocci series depending upon the size. Use System.out.println or System.out.print for printing.
}
}



Print Number And Symbol Formation

Write a program to print the following number and symbol formation depending upon input size. Use System.out.println or System.out.print for printing.
Input (Integer) Printed Output
4
1 2 
* * * 
1 2 3 4
5
1 2 
* * * 
1 2 3 4 
* * * * *
6
1 2 
* * * 
1 2 3 4 
* * * * *
1 2 3 4 5 6
class PrintFormation

{    public static void main(String s[])
    {
        printFormation(5);

    }


public static void printFormation(int size)
{
//Write code here to print the required formation depending upon the size. Use System.out.println or System.out.print for printing.
}
}



Print Symbol Formation

Write a program to print the following formation depending upon size of the matrix. Use System.out.println or System.out.print for printing.
Input (Integer) Printed Output
4
- - 
* * * 
- - - -
5
- - 
* * * 
- - - - 
* * * * *
6
- - 
* * * 
- - - - 
* * * * *
- - - - - -
class PrintFormation

{    public static void main(String s[])
    {
        printFormation(5);

    }


public static void printFormation(int size)
{
//Write code here to print the required formation depending upon the size. Use System.out.println or System.out.print for printing.
}
}



Find if a number is palindrome

Write a program to find if the given number is palindrome. A palindrome number which when reversed will be the same as original.
Input (Integer) Output (Boolean)
121 true
123 false
7887 true
90009 true
90010 false
class PalindromeNumber

{    public static void main(String s[])
    {
        boolean palindrome = isPalindrome(1221);
        
        if(palindrome)
            System.out.println("1221 is a palindrome.");
        else
            System.out.println("1221 is not a palindrome.");

    }


public static boolean isPalindrome(int number)
{
boolean result = false;
//Write code here to find if the number is palindrome and assign it to result.
return result;
}
}



Print multiplication table

Write a program to print the multiplication table of the given number. Use System.out.println or System.out.print for printing.
Input (Integer) Output to be printed (Spaces before and after 'x' and '=' are also important in the output)
4 4 x 1 = 4
4 x 2 = 8
4 x 3 = 12
4 x 4 = 16
4 x 5 = 20
4 x 6 = 24
4 x 7 = 28
4 x 8 = 32
4 x 9 = 36
4 x 10 = 40
5 5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
class MultiplicationTable

{    public static void main(String s[])
    {
        printMultiplicationTable(5);

    }


public static void printMultiplicationTable(int number)
{
//Write code here to print the required multiplication table of the number. Use System.out.println or System.out.print for printing.
}
}



© meritcampus 2019

All Rights Reserved.

Open In App