Question

Please select the output: main         declare X as integer, Y as integer                        &nbsp

  • Please select the output:

main

        declare X as integer, Y as integer

                                set x=1

                                set y=2

                                call sub(x, y)

                                write x

                                write y

End program

Subprogram sub( integer Num1 as ref, Integer Mum2 as reference)

            

                                                declare x as integer

                                                set Num1 = 3

                                                set Num2 = 4

                                                set x= 5

                                                write x

end subprogram          
Please select one:      5/42, 5/34, 5/32, 5/24

  • What is the output of this pseudo code

Main

         declare F as Integer

                                F = 1

                                set result = F(K)

                                write result

end program

Function F(N) as integer

         if N == 1 Then

                                           set F = 1

         else

                                           set F = N * F(N-1)

                                                                   set N = N-1

                     end if

end function

Answer:

6, 1, 4, 3

  • What occurs during max = x in this pseudocode

Def find_max (L);

        Max = 0

        For x in L;

               If x > max;

                Max = x

Return max

  • Max is declared as a variable
  • Max is compared to another variable
  • Max is set equal to the largest number
  • Max is set equal to an ongoing array
  • What is displayed at step 5 in the pseudocode if the value of num1 =3 and num2 = 2?
  • Step1 : Start
  • Step2 : Declare num1, num2, sum as integers
  • Step3 : Read values num1 and num2
  • Step4 : sum = num1 + num2
  • Step5 : Display sum – 1
  • Step6 : Stop

                          Answer: 2, 3, 4, 5

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Question 1:
5/34

Question 2:
1

Question 3:
Max is set equal to the largest number

Question 4:
4
Add a comment
Know the answer?
Add Answer to:
Please select the output: main         declare X as integer, Y as integer                        &nbsp
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum...

    In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + count End While Return sum End Function Function Integer perfect_sum(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + perfect(count) End While Return sum End Function Module main() Display perfect_sum(5)...

  • Convert the following pseudocode into C++ language. Declare X, Y, Z As Integer For (X =...

    Convert the following pseudocode into C++ language. Declare X, Y, Z As Integer For (X = 1; X < 4; X++) Write “Pass Number “ + X For (Y = 1; Y < 10; Y+3) Set Z = X + Y Write X + “ + “ + Y + “ = “+ Z End For(Y) End For(X)

  • What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set...

    What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set TheNumber = 12 For (Count = 10; Count>TheNumber; Count--) Write TheNumber + Count End For A) The limit condition in a For loop cannot be a variable B) The loop will never be entered since the initial value of Count is less than the test condition C) The loop will never end since the test condition will never be met D) A counter must...

  • . please trace the code including the value in every register 1. Express the instruction on...

    . please trace the code including the value in every register 1. Express the instruction on line 9 of the program in 32-bit machine language, and if necessary, refer to the table in the appendix. 2. Set 000beef00 to $ s0 as input and calculate the value of $ s0 at the end of each step (lines 9, 13, 17, 21, 25) when executing the above program (binary or Write in hexadecimal).   3. Briefly explain the operation of the above...

  • Create a CalculatorTest class that contains the main method. 1. Get two double numbers as input...

    Create a CalculatorTest class that contains the main method. 1. Get two double numbers as input and create an object of the ScientificCalculator Class with those two numbers. 2. Then call the 8 operations one by one sequentially and display the result. Code must be written in Java. (Sample input/output: Enter number 1: 2 Enter number 2: 3 Add() result is : 5 Sub() result is: -1 ……. Power() result is: 8 …… sqrtNum1 result is:) The Problem: Given the...

  • 1. declare two integer variables x and y and two pointers to p and q. initialize...

    1. declare two integer variables x and y and two pointers to p and q. initialize the value of x with 2, y with 8 and the pointer p should point to the address of x and q should point to the address of y. 2. then write a C statements that will print the following information: a. the address of x and the value of y. b. the value of p and the value of *p. c. the address...

  • Declare a 4 x 5 array called N. Write a subprogram called printlt to print the...

    Declare a 4 x 5 array called N. Write a subprogram called printlt to print the values in N. Use this subprogram to print the values in the array after each part of the initialization exercise. Write the loops to initialize the array to the following: A. 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 B. 1 1 1 1 1 2 2 2 2 2 3 3...

  • CONCEPTS OF PROGRAMMING LANGUAGE Consider the following program skeleton Procedure Main is X, Y, Z: Integer;...

    CONCEPTS OF PROGRAMMING LANGUAGE Consider the following program skeleton Procedure Main is X, Y, Z: Integer; procedure Sub1 is A, Y, Z: Integer; begin -- of Sub1 ... end; -- of Sub1 procedure Sub2 is A, B, Z: Integer; begin -- of Sub2 ... end; -- of Sub2 procedure Sub3 is A, X, W: Integer; begin -- of Sub3 ... end; -- of Sub3 begin - of Main ... end; -- of Main Given the following calling sequences and assuming...

  • Consider the following pseudocode Xinteger procedure set x(n global integer) Xin procedure print x write integer(x)...

    Consider the following pseudocode Xinteger procedure set x(n global integer) Xin procedure print x write integer(x) procedure first set x(1) print x procedure second xinteger set x(2) print x set x(e) first() print x second print x What does this program print if the language uses static scoping? What does it print with dynamic scoping? Why?

  • 1) Declare and initialize a pointer px to an integer variable x with the initialized value...

    1) Declare and initialize a pointer px to an integer variable x with the initialized value 3. Consider two cases of the value of x allocate on (a) the stack memory (b) the heap memory 2) Write a comment on each instruction down below and provide a memory diagram for heap and stack to illustrate these statements. int* iptr = new int[5]; // int* iptr_1 = new int(5); //

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT