BS Computer Science 1st Year A21
BS Computer Science 1st Year A21
NOTE: Attempt any FOUR guesfions. AIt questions carry equal marks.
Qucction No 2:
a" Wrltc sny four propertler of absoluto vrtucc. (4 marks)
b. solve au lrequality beloy ald crprcar &e &tu6on set ar an lntsrvel or unlon of
'
tbe lntervalr. (Smarlc)
t-z-4fr+4>o
c. Srywhether tho functions orrceven, odd or nolther. $ markr)
f(r) = s, f (x) = *, f@) = * and /(rr) = tft31,
Question# 3
r, Wrlte an equation for ths llno through (-2, -1) rnd (3,4). (4 marlc)
b. Find tte averrge rate ofe.brogc ofthe ftrnctious ovcr tLe (t narlr)
glven lnterval .
L f(x) =rf + 1, t-r, 11
tl. l(t) = cott, ti,*1
rind llm cos fl-l)
za7, \ r-1 ./
Fbd the diccortiruiUe of f (r) =
'
COS if aoy. Derormtne
;b
f(t) =$o*rtinuous. G narkc)
Question No,l
a. Confirm that the strtcd formulr ls thc tocal linear approximation oilat rs -- l,
whercAr=^r-1. ({nuks)
f(r) = rai (1 +At)1 l;1*4Ar
b. Ftadrhelimrt lim fin'. (t markr)
t-r0+
c. Find an intend [s, il ol which
t@)={ +f -* + r- 2cr&llertlehypotteraof
RolletsTbco!.m.
Il. Generatc tbe grep[ of f'(r), ead urc lt to melrc rcugL
ostlmrb of all vrluer of c ln thc interval obAlned ln pert (l)
thet oatb$ thccouclusloa of Rolletr lteortm.
ut. Use Ncriol'c Mo&od !o lmprove on lhc rougi csfimahc
obtalncdhpa*0t). (tmerb)
JG* se*rx)dx
L
it. I ttn' x cas x drc
c. Approprlrto formulas lbom goometry to evaluaie the lntegrals (8 merks)
i. [!rt+ - sx) dx.
t. fr(r * ffi\dx.
QuoctbnNo6
r. Dellne llncar oquatlol ln terms of difterentlal equttior with lt3 typc .rd
exrmpl6. (a marlrr)
A tank wlth o lfi)0 gat capacity initlally conteinr t(D gd of *o&r tbot lr polluied
vtth !0 lb of perticulate mrtter. At timc , - 0, pure rvrter ls iddcd at a reic of 20
galrtnln ond the mixcd rdution lr drahcd oflat a nto of l0 grDfoln. Eor much
parthuhto metter is ln the trnk wlen lt rcrche tic poht ofovorlloving?
(8 nerlcs)
Page 2 ol 2
UNIVERSITY OF THE PUNJAB '.,.x.ollNo. in Fig.
B.S. in Computer Science First year : Annual-202i
Subject: Calculus I
'.. Roll No. in Words.
PaPer: 1
\
_ Time:3O Min. Marks: 20..
g
aaaa
NOTE: Attempt any FOIIR guesfions. All questions carry equal marks'
Quectlon No 2:
.& find.tboertcrand radlusof tborphere ({ nlrft}
x2 + y2 + L2 - 2x* 4y *8e * \7 = A.
b, Lct f,r and f,2 bo the lineo (8 mrrln)
L1 s x s 1 +'*qY s 5- &t * -1 +5t
L3r x = 2 +8\Y= {-3t,2 = 5 + t
Arc the tinee parallel? Ilo t[e linoc lnterccct?
Quecdor# 3
&. FInd tho gope of the line ln 2-epae thrt lr reprccontd by the voctor equatbn
r; (1 * zttt - (2 - 38)r. (4urrks)
Quertbu No {
a. $upposcthatz = *yrx = *rI f
= llsotLoctdr rsleto fnOSadchce.kthe
result by expresing I u r funcllon of t qnd dllfcrentldlug dtru{fy.
({ mar}r)
veluec of
' b. Use Lagrange mulfipllerc to ltnd tle muimum rnd minlmum
Lxz + *f + * o?A'
f(x,!,s) a 3x + 6y * 2z rubfcct to tto vTconstrdut -
*ntn thecc xocme luer {tGctrr.
also, find tbc polntr at
(8 mrkt}
Page 1 ot 2 P.T.O.
Qucrdoa I{o 5
i. Evdurte tLo doubrc I{ rnsnl **fdi orcr t&* rcehnguhr rrglor
r=ffay):-tsr< l,*2 syszI. ({mrr*r)
b' Thcryhcret' + t' *
+ = sF mn bo cxprwod ln cploriml omrdlue& rr
p* c, 8[d &c qphGrfurl'eroctnn$hr conwrrton furfrufru crn &!r !p rrcd to
cxpmcs the rpherc ag tjbc vetor-rrnln*d lhncfior
r(e,O) = csln ecos0t + asln.pshrll + acasg*
vhcrc0 ( p S nard0 { f 5 &r,Ureft*itbncftatolhortirttendlur
vos{r b'rcrud td th irrgsrt ptrrarts Nrtou ec
rybprg (s Grr*r}
Ermlnrtc ths ltcrrtod int!*rr[ (8 marki)
(r'? v
Jr1,,JW dx dy da
Quxtion No 6
t Ftnd &c dlvorgoac and tbo curl of tlc rrytor lldd ({ marla}
f(ay,z) o*fi+2f* +3s*.
b, Evelu*tc ttc llne lntqnrt fic f* *
*ldy wbeir C lg tLc quatr wltt vffis
(0r 0b (t' 0), Or 1), rnd (0t t) or{onH eoun&rdockni*c, by ustrg Grtrn's
Thrortm rnd chock fu rmru ty crrlurffng lt illrcr,tly.
(s mrb)
r- Virlly ths $tokcr' lteortm by arrrturrtng tte llnc tnqml rnd {Lc rur{ac
tBicgrst Accnme thrt &e curfrm har rn upwrld ortcnufiou. fi mjr{E}
(s * ylt + (E + r)r (r + y)Iq
f(r,f,r)= -
rls&c pordon oftheparrlolotds = g * t - fabove&cry-flrna
Qtxflon No 7
& Ure tbe llivcrgoace Ihorrm to Snd tbo cutrrard ttuxof tltvoctor Setd
F(x,y,z) = Zxt * ?yl +szr( across tlp rrit cube {4 marks}
& Ernrla*to &o curfasc rnqrd IIn *rd$rhsre ck tls part of tho p[*nax+y *s - ,
that lies in ths flrst octrnt {8 marls}
Page 2 ol 2
... Roll No. in Fig..,..............,....
UNIVERSITY OF THE PUNJAB
B.S. in computer Science FirstYear: Annual-2021
Calculus ll
iil;; il. -.,r", ro'.loll
' Roll No' in wotds.
\\Signature of Supdt :
A. Yes B.No
II. Can we crctte trrey of rcference?
A. Yes B.No
ilI. YVhen can we bave two classcc wlth somc name?
A. Wecan't have B. In different wotk space
C. Can havc but in different file D. We can havc in any Scenario
ry. Cen a clrss contaln another class itr lt?
A. Ycs B.No
v. Whrt is the size of void tn C{-+?
A- 2bytes B.4bytcs CUndefined D.0
VI. Cen e fuuction catl itselp
A. Yes B.No
VII. Can a structure conteiu pointer to itselfl
A. Yes B.No
Vm Which operstor has higtcst prcccdence?
A. Yes B. No
IL Cau we have pure Vlrtuel Destructor?
A. Yes B.No
UNIVERSITY OF THE PUNJAB aaoaaoaaaaaataaaataaa
a.
! ...,............ :
ffi B.S, in Gomputer Science Firsf Year
Subject: Programming Fundamentals
: Annuat-2021
Paper:3-N
Roll No.
laaaaa a aaaa a aataaa
NOTE: Attempt any FOttR guestions. All questfons carry equal marks.
Q.2. Write the output of following code segments: (15)
(a)
clsscale'
t
charGrdc;
intBoms;
public:
Calo()
{ Grade=E;
Bonus=0;
l
void Down(imG)
{
Grade--G;
)
void U(intG)
{
GradE.t_ G;
Bonusr+;
)
voidShow$
{
oout << Grade << '#" << Bonus << endl;
));
intmainQ'
{
CalcC;
C.Dour(2)
C.Shou0;
C.UilA;
C.Show0;
C.Doo'n(2h
C.ShowQ;
)
(b)
intmain$
{
cttar tstting = "welcone';
int *Point, Vatue[J = {10'15,70,19};
Point= Vatue;
cnut {( +Point << SEing << cndli
String't+;
Point++;
cout << tPoint << Strirg << ondl;
)
#include<iosheam> "1
using ncnespece std;
clasg Test
privete :
int marks = 85;
public:
Tes(int marks)
{
couf<( thls--:mu{rsi
cout<<endl.
)
h
tnt mainO
!
{ I
:
Tcst t(95); t
return 0; I
I
I
) I
i
(d) _._J
#include <iosream>
usingnamcspace std;
iut mainQ
{ int i, x[5J, y, z[5];
for(i=0;i<5;i++;1
x[iJ = 1;
zlil=, + 3;
y= z[i];
x[iJ =y++; ]
for(i-0;i<5;i++1
cout <<x[i] << u o.
retunr 0;
)
(e)
i
i #inoludeciostrcam>
#includxcsoing>
ustng nrmeproe std;
htnainQ
t I
I
I
ch&r *sT"GOODLUCK'; I
I
{ I
for(int i=0ii <=iiitt+) I
t-
eout**{ils
I sout<<endl;
,
,
i
)
retum 0; )
Page 2 ol 3 P.T.O.
Write aprogram that displays the following oUpt*tsiryaay loop.
12345432
1234 432
123 32
L2 2
Ouestion # 4:
Defi6 a fimctioo named montbly-profit which will cdcplatc thc moo&ly profit on the givcn
investmsnt amount. Function will Uk€ fio lloat aryuuentl, P€,tceot ptofit rstc aod investnoqtt
mtourt ed tEturn the monthly pmfit (float). Write firnction pmOtpe, function do,finition ard a
main program to denronshate the functionality.
Note: Uscr can cnter any values thercforc writc generalizcd firnctlon for uscr rrariablor (Not
initialized the variable value).
Oucstlon#6:
Deflne a class Employ€e to storc dre rccords of cmployces. Wc want to storc only Namq age aod
address of cmploycc. Write main program to input lccord of one pcrson aad display 'Young' if
is agc is lcss lhan 20 or 'Old' if thc age is geet than 50 ard 'Mddlc' if ttc agc of percol is
betwcen2l and49.
gsegeg-tzr
Write a program that sort the giv€n data in desoending odcr using bubblc aort tccbnique?
s1520433 1819
Page 3 of 3
A UNIVERSITY OF THE PUNJAB
aa a a a a aaaaao
a
t aa aoa a aao
NOTE: Attempt TWO guestions from each Secfion. Atl questions carry equal marks.
Section - I
ELECTRICITY AND MAGNETISM
")
m;:ffi E'ldsol ic shorad h a reeioo of nuifcrm docldc fidd ag *ouar h
figua fid fu docria fftn {uutgh tre fioot frcc oftbc cnbo if thedoafio field ia ghrco
by E - G3NIC) I + (61.[/C] r. Also crtcdrtc trF to8l 0tu' thrutgh fto q&a
e) $tric d oryltitr Ganss'g l$v. fid lhc elcpfiic fo$o &$ to En infiiic #a of ohmgs.
b) trrftq rhc proe€rfirs of clcctdc fiGld lim.
cl Coudthr E point cfrcgo qr- *22pC at &G oridn rnd a smnd poid chrgo rB' +l:pe
at a diltaocs L aloog x axis, c/hcre Lr"l5cm. Fidthc poiil P alory tllc x uis xficrc fu
cloctric field is eqtal to zcro.
Section - ll
BASIC ELECTRONICS
,q
ts
\
iro{t
Page 1 of 2 P.T.O.
QBGrffm no,6: fiOtl0-80}
r) Drocr&c h6&Ih! dyds, fr$* iho$s Ss r.hmrrui*ic* suso of a Silfuon dods
instod in a cirqrit hfi,&{f r€Ei*trwi& rxiSmcc R" fipd fu Q,pofu m lb 3raeh, lf
rcciwev&r ic doubh4 xlhs isfu !fru$ on loq mdVoo
b
l0i
c'
N.
I'
t.
C,
{.
t,
7.
t
t l t a t t , t tro
,roro
j
t.it
Page 2 of 2
UNIVERSITY OF THE PUNJAB Roll No. in Fig. ......,..............
B.S. in Computer Science First Year I Annual-2021
subiect: Etectricity and Magnetism & Basic Electronica '. Roll No. in Words. .....;.t....
Paper: 5-N
Time: 30 Min. Marks: 2O'..
Q.1. Encircle the right answer cutting and ovenrvriting is not allowed. (10x2=201
1) Eloctsic-chrga A aod B io c.ch o{t r, &tic d
?r.yrrd
eloctric charga A ard C are beH clorc toged,cr 6cy
chargc, B c ,?d cact orhrs, if
a)Aruaa wil _ "ait
ottcr.
c)R€pat
b) No effoct d) M&tinfornarionisM€d ro aoswcr