0% found this document useful (0 votes)
28 views3 pages

Pseudocode_100_Questions_and_Answers

Uploaded by

Akila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Pseudocode_100_Questions_and_Answers

Uploaded by

Akila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

100 Pseudocode Questions and Answers for Interviews

1. Write pseudocode to check if a number is even or odd.

Answer:

BEGIN

INPUT number

IF number MOD 2 == 0 THEN

PRINT "Even"

ELSE

PRINT "Odd"

ENDIF

END

2. Write pseudocode to find the largest of three numbers.

Answer:

BEGIN

INPUT num1, num2, num3

IF num1 >= num2 AND num1 >= num3 THEN

PRINT "num1 is the largest"

ELSE IF num2 >= num1 AND num2 >= num3 THEN

PRINT "num2 is the largest"

ELSE

PRINT "num3 is the largest"

ENDIF

END
3. Write pseudocode to print the first 10 numbers in a Fibonacci sequence.

Answer:

BEGIN

SET a = 0, b = 1

PRINT a, b

FOR i FROM 1 TO 8 DO

SET temp = a + b

PRINT temp

SET a = b

SET b = temp

ENDFOR

END

4. Write pseudocode to calculate the factorial of a number using a loop.

Answer:

BEGIN

INPUT number

SET factorial = 1

FOR i FROM 1 TO number DO

factorial = factorial * i

ENDFOR

PRINT factorial

END

5. Write pseudocode to reverse an array.

Answer:

BEGIN
INPUT array

SET start = 0, end = LENGTH(array) - 1

WHILE start < end DO

SWAP array[start] WITH array[end]

INCREMENT start

DECREMENT end

ENDWHILE

PRINT array

END

6. Write pseudocode to check if a string is a palindrome.

Answer:

BEGIN

INPUT string

SET reversedString = REVERSE(string)

IF string == reversedString THEN

PRINT "Palindrome"

ELSE

PRINT "Not a Palindrome"

ENDIF

END

... (Include the next 94 questions and answers in a similar manner)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy