0% found this document useful (0 votes)
8 views6 pages

Week 5 Computer Programming Questions

This document contains 22 questions about computer programming concepts like input/output, number systems, operators, flow charts, pseudocode, switch cases, looping, and arrays for a weekly tutorial. The questions cover a variety of basic programming topics and are meant to enhance understanding and learning through practice. Students are to submit their answers offline by a specified deadline.

Uploaded by

ArchitSharma
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)
8 views6 pages

Week 5 Computer Programming Questions

This document contains 22 questions about computer programming concepts like input/output, number systems, operators, flow charts, pseudocode, switch cases, looping, and arrays for a weekly tutorial. The questions cover a variety of basic programming topics and are meant to enhance understanding and learning through practice. Students are to submit their answers offline by a specified deadline.

Uploaded by

ArchitSharma
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

ComputerProgramming

TutorialQuestions(Week5)

SubmissionDeadline:___________

Allquestionsaremandatory.
[Link]
madeoffline.

Input/Output
[Link].
main()
{
floata
a=4/2
printf(%f%f%f,a,4/2,4.0/2)
}

NumberSystem
[Link]
1.)6A4C 2.)1234
3.)AADC
4.)0B23

[Link]
1.)0123(base4)tobase8
2.)6521(base8)tobase16

Operators
[Link].
main()
{
inta=30,b=40,x
x=(a!=10)&&(b=50)
printf(x=%d,x)
}

[Link].
inta=2
intb=5,c
A.)c=b/a+5/2
B.)c=b/2+5/a
C.)c=b/2.5+a
D.)c=b*a/5+(5.0/2.5)
Whichoftheaboveoptionsareequivalent??


[Link].
#include<stdio.h>
main()
{
intx=10,y=20,z=5,i
i=x<y<z
printf("%d\n",i)
}

[Link].
a=5,b=3,c=4
A.)x=a>b
B.)x=c<b
C.)x=a>b&&c>b
D.)x=a>b||c>b

[Link].
main()
{
intx,y
x=3(3)
printf(%d,x)
}

FlowChart/Pseudocode
[Link]/algorithmtodrawthefollowingpattern:

***********
**********
********
******
****
**
****
******
********
**********
***********

[Link]
whichisreverseoftheformer.

[Link]
followingpattern.
1
1
2
1
1
2
3
2
1
1
2
3
4
3
2
1

SwitchCase
[Link].
#include<stdio.h>
main()
{
inti=10
intc=10
switch(c)
{
casei:
printf("Valueofc=%d",c)
break
/*Somemorecases*/
}
}

[Link].
#include<stdio.h>
main()
{
intx=2
switch(x)
{
case1:printf("Choiceis1\n")
case2:printf("Choiceis2\n")
case3:printf("Choiceis3\n")
default:printf("Choiceotherthan1,2,3and4\n")
break
case4:printf("Choiceis4\n")
break
}
printf("AfterSwitch")
}

[Link].
main()
{
floatx=1.0
switch(x)
{
case1.0:printf("Choiceis1")
break
default:printf("Choiceotherthan1,2and3")
break
}
}

[Link].
main()
{
intx=1
switch(x)
{
x=x+1
printf(Choiceshastobemadenow.)
case1:printf("Choiceis1")
break
case2:printf("Choiceis2")
break
default:printf("Choiceotherthan1and2")
break

}
}

[Link].
main()
{
intx=1
switch(x)
{
case2:printf("Choiceis1")
break
case1+1:printf("Choiceis2")
break
}
}

[Link].
main()
{
inti=0
switch(i)
{
case'0':printf("Hii")
break
case'1':printf("Heyy")
break
default:printf("Bye")
}
}

Looping
[Link].
main()
{
inti=0
while(i<3)
{
printf("loop")
continue
i++
}
}

[Link].
main()
{
inti=0
for(i<3i++)
{
printf("loop")
continue
}
}

[Link].
main()
{
intj=1
while(j<=255)
{
printf(%c%d\n,j,j)
j++
}
}

Arrays/Strings

[Link].

main()
{
inti
intarr[5]={1}
for(i=0i<5i++)
printf("%d",arr[i])
}

[Link].
main()
{
charp
charbuf[10]={1,2,3,4,5,6,9,8}
p=(buf+1)[5]
printf("%d\n",p)
}

You might also like