FastPrepFind Out Prime or Composite
Problems/Find Out Prime or Composite

Find Out Prime or Composite

Cisco logoCisco● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given a list of size positive integers, elements. For each element, decide whether it is prime or composite.

  • A number is prime if it is greater than 1 and its only positive divisors are 1 and itself. Write "Prime" for it.
  • Every other number is non-prime. Write "Composite" for it. This includes 1, which is not prime.

Return one string with the words in the same order as the elements, separated by single spaces.

Function

findOutPrimeOrComposite(size: int, elements: int[]) → String

Examples

Example 1

size = 5elements = [541, 37, 113, 5, 10]return = "Prime Prime Prime Prime Composite"

From the given list, elements (541, 37, 113, 5) are prime numbers and (10) is a composite number.

Constraints

  • 1 ≤ size ≤ 1000
  • elements.length == size
  • 1 ≤ elements[i] ≤ 10^7

More Cisco interview questions

  • Check if a String Is a PalindromePHONE SCREEN · Seen Nov 2026
  • Find Unique ElementsPHONE SCREEN · Seen Nov 2026
  • First Letter to Appear TwicePHONE SCREEN · Seen Nov 2026
  • Middle of a Linked ListPHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Reverse a StringPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • K-Step Bit Flip with RetentionPHONE SCREEN · Seen Nov 2026
  • Todo Task Manager OperationsONSITE INTERVIEW · Seen Oct 2026
  • Find the Duplicate Number Without Modifying the ArrayONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Last Digit of the Ways to Split Traders Between Two OfficesAkuna Capital · OAAkuna Capital interview questions
  • Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
All Cisco interview questionsSee Cisco hiring insights
Saved
class Solution {
    public String findOutPrimeOrComposite(int size, int[] elements) {
      // Write your code here

    }

}
Checking account…