You are on page 1of 10

main function.

Sample input & Output

S. no Input Output

Algorithm staot
Rend P, t,Y aluek
Si Patar
oo

Prart st

sst

Flowchart
Staot

Read PtY Valued

si = P t
too

Print s

Stop
cOMPUTATIONAL THINKING FOF

Execution:

include 2stdio h>


4let si (int, int , fleto)
fleat silit P, ictt,flatr )
elat ieEt

int rair C)E


iet ,ts

Stan (hd d /4",8f, st, a)}


hot o siLFt,D;
riot +",);

Test case Table:

Testcase# Testcase
with eacn questi
questions
assigned distinct marks for each of 3 questions. This means no two questions can hav=
marks. Find the minimum and maximum marks that he has set the paper for. Solve
same

problem using arrays by declaring the array globally.

Sample Input & Output

S. no Input Output

Algorithm 1 stat
Rend mC]
3.) Puint na ms
3 m (63>m],mC) >ml),
3-) ebe it (m>mlol, mj>m{z), 3z) Point roa="T7
5) ebe ( m i i J >mlo), ) , 33) P r t o d = m[z

4 mCole m , misie m ) q) Pocit onin = moj-


ebe ( mEi7 <mJ , m7em ) , qa) Paid Tnn = r C
Flowchart
3 d ik (memI,G)em),43) Prant min m
sstf
(Sta

Read m33

m E1 F ml
7
a
m
m

mC

LEm]/Lmac=m

/ Print min= rrid muncr0) /rinl minm} Stop


Pge 53 of 368
COMPUTATIONAL THINKING
FORSTRUCT
Execution:
#incude c stdio h>
int main C)
2
ivt mC];
Can-d fd &m,2m0,imi3);
ce >
ie(mj rtl, mU1 >m
e
int (*mad
maz=d
=d, TLI);}
mI);
tm> m, ni]>m)
hantCroa=s',mRg
els
e(mem[),m0) <m)hint [nun= d', Tm
elbe it (mem,mem0) S
min=d',
tripie TO

& Output
Sample Input
Output
S. no Input

mim= 30m

Algorithm stmt
Reod , talus.

a 34* , b= 2*
i4 (acb
4 che Prumt b

ssp

Flowchart
Stant

/RLad ,y valuts/

o3+
b 2*

F
ocb Printa
/eriedb
cOMPUTATIONAL THINKING FOR STRLJCTU

Execution:
t incluce c stdioh>

irt aimC)7
irt ,
Saont (/d, 34, 3)
int a 3 *z
(nt b 28
ie(acb)
PrintfCrin =
hd', a);{
cbe rint (*min = dJ", b); f

Test case Table:

Testcase# Testcase Type Input Expected Output after Testcase Result:


output execution
L - looo Pass/fail
4-2oc0 min-3 mun=-30o
2 =2000 mun-Zcco Pa
yelcco mun-2000

(For Evaluator's use


only)

Comment of the Evaluator (if


Any)
EvaluatSecured:_
Marks or'sObservation out of
Full Name of
the Evaluator
S
Date of thee Session:JJ Time of the Session:to
Skil-2
Problem 1:

a. Predict the output for the following code:


#include<stdio.h>

void f
int a
a-20;
d0:
printf(%d"a);

voidd)
int a
a-30;
printf("%d"a);

int main()D
int a

a 10;
printf"%d", a);
f0:
return 0;

Output: 10 30 20

a = to Print a = lo

a 30 Puta= 30

Prin a = 20

Page 63 of 368
code:
for the following
b. Predict the output

Wincludecstdlo.h>

vold maln()
auto int num;
num 20;

auto Int num;


num= 60;
printf("Num:%d\n",num);
m Pnt
printf("Num : %d\n ", num); num=6o
0rddn
Coming
Output: 60
20

c.Predict the output for the following code:

#include<stdio.h>
void increment(void);
void main(0
increment();
increment();
increment();
increment();
void increment(void)

auto int i = 0;

printf("%d", i);
i=i+1;

Output:

Page 64 of 368
u p r s e d i t t t h e t u t u t t t o thes f o l l o w i n g o d e ?

stati terne()
it ifnt t,

it
int j 1

1,

i o P r i r t
ntf("dn", )
1,

rmaint)
sticDermol)
ticDeno), 3
J =241
- Pit
srput: O 2
i i=2

Predict the output and trace the values.

clude«stdio.h
atic int gint = 1;

aticvoid staticDemo(){
tatic int i;

rintf("%d ", i);


i1

rintf("%d\n", gint);
Int gint+1;

nt main() {
taticDemo()
aticDemol);

output: ot

Page 65 of 368
Session:/
Date ofthe
coder
Problem 2 following
for the
Predict
the output
a.

#includecstdio.h»
Tii 2
int fund);
intnum5
intmain()f
r i t nwm)
fun value %d \n",num),fun();
p r i n t f ( " ' n g l o b a l n u m

- %d \n ",num);fun(
m3 ?ru t
value
p r i n t f / " n g l o b a l n u m

",num);return 0;
printf("ngiobalnum
value-%d \n
Printnur

int fun() pum,


Pridet npms
static int num 2;
\n",num);num=num+1;
%d
printf("\nstaticnum value
return 0; Pruikrum-

Output 23 S S

b. Predict the output for the following code:

#include cstdio.h>
extern int a;
int main()1

printf ("d", a),

inta 20
Output:

Page G6 of
368

You might also like