retagged by
3,060 views
3 votes
3 votes

Pick the true statement for an algorithm:

A) An algorithm  can have zero or more inputs but must have one or more outputs.

B) An algorithm  can have one or more inputs but must have zero or more outputs.

C) An algorithm  can have zero or more inputs and outputs.

D) An algorithm  can have one or more inputs and outputs

retagged by

2 Answers

0 votes
0 votes

Consider the following algo:

while(1)

{

     printf("...");

}

Without any input, it gives output. So, zero input and one output.

Also, consider given code segment:

int a;

while(1)

{

     scanf(a);

     if( a == 0)

           print(a);

}

So, it can have zero or more output and can have one or more input.

So, answer is (C).

Related questions

0 votes
0 votes
0 answers
2
Sajal Mallick asked Nov 27, 2023
171 views
As we have to select maximal set of “non overlapping” activities. So like job scheduling algo of greedy we can solve it. So according to that complexity must be O(n l...
4 votes
4 votes
3 answers
3
Lakshman Bhaiya asked Nov 10, 2018
12,298 views
If job $J=(J_{1},J_{2},J_{3},J_{4})$ are given their processing time $T_{i}=(1,1,2,3)$ and deadline are $D_{i}=(3,4,2,3)$ maximum how many job can be done$?$$A)1$ ...