Question 1
Suppose you have two 8-bit binary numbers, A and B, represented as (00010101)2 and (00000110)2, respectively. Perform the subtraction A−B and determine the decimal equivalent of the result.
19
15
21
6
Suppose you have two 8-bit binary numbers, A and B, represented as (00010101)2 and (00000110)2, respectively. Perform the subtraction A−B and determine the decimal equivalent of the result.
19
15
21
6
Consider the following algorithm where number n stored in register R1, and the final result stored in register R2.
1. R1 = n
2. R2 = 1
3. R2 = R2 * R1
4. R1 = R1 - 1
5. If R1 > 0, go to step 3, otherwise go to step 6.
6. Print(R2)
Which of the following statements represents the correct purpose of the given algorithm?
The algorithm calculates the sum of all numbers from 1 to n.
The algorithm calculates the power of 2 raised to n.
The algorithm calculates the nth Fibonacci number.
The algorithm calculates the factorial of the number n.
Consider the below C program.
#include <stdio.h>
int main() { int n = 10; int i = 0, j = 1; while (i < n) { printf("%d ", i); i += j; j++; } return 0;}What will be the output of the above program?
0 1 2 3 4 5 6 7 8 9
0 1 3 6
0 2 4 8
1 3 6 10
Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.
The IIT Madras BS Introduction to C Programming (Intro to C Programming) Qualifier paper sat on 1 Sept 2024, in the May 2024 term: 16 questions for 50 marks in 120 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.
| Feature | Intro to C Programming Qualifier 1 Sept 2024 at a glance |
|---|---|
| Term | May 2024 term |
| Subject | Introduction to C Programming |
| Course code | CS1101 |
| Questions | 16 |
| Marks | 50 |
| Duration | 120 min |
| MCQ | 15 |
| MSQ | 1 |
| Official paper | IIT M ES REATTEMPT AN EXAM QEF1 01 Sep 2024 |
| Negative marking | No negative marking. |
| Updated |