ONLINE QUIZ 1 [JAN 29, 2017, 9 AM to 9 PM] > ONLINE QUIZ [JAN 29, 2017] > Unit
Bookmarks
Unit
Bookmark this page
ONLINE QUIZ
1 [JAN 29,
2017, 9 AM to Online Quiz 1 [Sunday 9 AM to 9 PM]
9 PM] 1.5 points possible (graded)
You will be allowed to submit your answers only ones. So, follow these
ONLINE QUIZ steps strictly:
[JAN 29, 2017]
Online Quizzes due 1. First, attempt all the questions.
Jan 29, 2017 21:00
IST
2. Ones you are ready to submit, click on "Final Check" button. Please
note that once you will click on "Final check" button, your answers will be
Introduction to uploaded and you will not get any other chance.
the course
3. THERE MAY BE MULTIPLE OPTIONS CORRECT FOR EACH QUESTION.
You have to select all the correct options to get it right.
Week 1
4. Consider this Quiz as a self test for yourself and your own
Week 2 understanding. Treat it as a mirror for your own understanding of the
contents. PLEASE DON'T CHEAT YOURSELF.
Week 3
Q1. Consider an 8-bit machine M which uses 2's complement binary
number representation. Suppose that three binary numbers stored in
this machine are A = 1101 1001, B = 0101 0101, D = 1010 1000. For this
machine, nd the value of C if:
A+B-C=D
1000 0111
1000 0110
1101 0110
https://edge.edx.org/courses/coursev1:BITSx+CSF111+2017_T2/courseware/4ce1bc9240134c909acd77d6bcf60fc1/f84604e5a47d40018e9a0fcd25c9f3ca/ 1/6
1/29/2017 Unit|ONLINEQUIZ[JAN29,2017]|CSF111Courseware|Edge
a == 5
a=5
a++ == 5
++a == 5
https://edge.edx.org/courses/coursev1:BITSx+CSF111+2017_T2/courseware/4ce1bc9240134c909acd77d6bcf60fc1/f84604e5a47d40018e9a0fcd25c9f3ca/ 2/6
1/29/2017 Unit|ONLINEQUIZ[JAN29,2017]|CSF111Courseware|Edge
(a == 5) || (++b)
(a == 5) && (++b)
(++b) && (a == 5)
(++b) || (a == 5)
https://edge.edx.org/courses/coursev1:BITSx+CSF111+2017_T2/courseware/4ce1bc9240134c909acd77d6bcf60fc1/f84604e5a47d40018e9a0fcd25c9f3ca/ 3/6
1/29/2017 Unit|ONLINEQUIZ[JAN29,2017]|CSF111Courseware|Edge
change all the occurrences of "if" keyword (except the rst one,
i.e. if (per >= 0)) with "else if".
void main()
{
oat per;
scanf ("%f", &per);
switch (per)
{
case (per >= 80):
printf ("A");
https://edge.edx.org/courses/coursev1:BITSx+CSF111+2017_T2/courseware/4ce1bc9240134c909acd77d6bcf60fc1/f84604e5a47d40018e9a0fcd25c9f3ca/ 4/6
1/29/2017 Unit|ONLINEQUIZ[JAN29,2017]|CSF111Courseware|Edge
break;
case (per >= 60):
printf ("B");
break;
case (per >= 40):
printf ("C");
break;
case (per >= 0):
printf ("D");
break;
}
}
First see and ensure yourself that the above code will not work. Now,
why this code will not work?
[Note: you should always remember these reasons. Also, it will be a
good programming practice to try writing program for the given
problem using switch case statements.]
You cannot use statement like "per >= 80" within case statement.
Since each case statement has two statements (printf and break),
you should use curly braces here to group them together.
Q7. If the desired output of the following program is "c = -5", which of
the following options can replace "stmt1" in the following code segment?
int main()
{
int a = 5, b = 7;
int c;
//stmt1
printf ("c = %d",c);
}
https://edge.edx.org/courses/coursev1:BITSx+CSF111+2017_T2/courseware/4ce1bc9240134c909acd77d6bcf60fc1/f84604e5a47d40018e9a0fcd25c9f3ca/ 5/6
1/29/2017 Unit|ONLINEQUIZ[JAN29,2017]|CSF111Courseware|Edge
c = a * b % a / b - a;
c = b * a % a / b - a;
c = b * a % b / a - a;
c = a / b % a / b - a;
https://edge.edx.org/courses/coursev1:BITSx+CSF111+2017_T2/courseware/4ce1bc9240134c909acd77d6bcf60fc1/f84604e5a47d40018e9a0fcd25c9f3ca/ 6/6