# An Introduction to Programming Through C++ | NPTEL 2022 | Week 1 Assignment Answers

This set of MCQ(multiple choice questions) focuses on the An Introduction to Programming Through C++ NPTEL 2022 Week 1 Assignment Answers.

You should practice these questions to improve fundamentals of An Introduction to Programming Through C++ needed for various interviews (like company interview, campus interview, walk-in interview), entrance exams, placements and other competitive exams. All the questions in this particular section are based on only “ An Introduction to Programming Through C++ NPTEL 2022 Week 1 Assignment 0 Answers“.

### Course layout

NOTE: You can check your answer immediately by clicking show answer button. An Introduction to Programming Through C++ NPTEL 2022 Week 1 Assignment Answers” contains 14 questions.

Now, start attempting the quiz.

### An Introduction to Programming Through C++ NPTEL 2022 Week 1 Assignment Answers

Suppose a “rightgoing step” consists of a upward going line of length 10 followed by a rightgoing line of length 10.  The following code draws 5 rightgoing steps, i.e. a staircase.  Assuming the turtlestarts pointing in the rightward direction, and assuming the steps rise by 50 in the right fill in the blanks.
repeat(5){ blankA; blankB; blankC; blankD;}
Given below are 4 fill in the blank questions.  You have to answer by writing only the required answer without any blanks or anything, as it would appear in your program.  For example for the first question you should fill “left(90)” (without the quotes).

Q1. What is blankA?

Q2. What is blankB?

Q3. What is blankC?

Q4. What is blankD?

Suppose you decide to represent the cards in a standard deck using the numbers 1 through 52. So for this, the cards are arranged so that the clubs come first, then the diamonds, then the hearts and then the spades. Also within a suit, the order of the cards is ace, then the cards 2 through 10, then the jack, then the queen, then the king. So after arranging the cards in this manner, the ith card is assigned the number i. Thus the king of spades will get the number 52, and the ace of clubs the number 1.

Q5. What number does the 9 of spades get?

An Introduction to Programming Through C++ NPTEL Week 1 Assignment Answers

Q6. Suppose some card has number n. I would like to know if it is a diamond. Which of the following tests will tell me if this is the case?

a) n > 26
b) ceiling(n/13) = 2
c) n mod 13 = 0
d) floor(n/13) = 2

Suppose I choose to represent a number using floating point, in 32 bits, using the representation discussed in the lecture.  Which of the following are correct?

Q7. I will be able to exactly represent the number 100000000 (100 million).

a) Yes
b) No

An Introduction to Programming Through C++ NPTEL Week 1 Assignment Answers

Q8. I will be able to approximately represent the number 1000000000000 (one trillion)

a) Yes
b) No

Q9. I will be able to exactly represent the number 1000.

a) Yes
b) No

Q10. I will be able to exactly represent the number 1/3 (one third).

a) Yes
b) No

An Introduction to Programming Through C++ NPTEL 2022 Assignment Solutions

Q11. Consider the multiplication instruction defined in the lecture.
Suppose now that I have a program 57 100 200 300 57 300 200 400.Suppose initially the 6, 7, 8, 9 are stored in addresses 100, 200, 300, 400 respectively.  After executing the 2 instructions given above, what would be present at address 400?

An Introduction to Programming Through C++ NPTEL 2022 Assignment Solutions

Table 1: (A) Control unit, (B) memory (C) compiler (D) capacitor
Table 2: (E) Can be used to store a bit, (F) Can be used to store many bits, (G) translates C++ program into machine language, (H) Fetches instructions

Q12. What most closely matches A?

a) E
b) F
c) G
d) H

Q13. What most closely matches B?

a) E
b) F
c) G
d) H

An Introduction to Programming Through C++ NPTEL 2022 Assignment Solutions

Q14. What most closely matches C?

a) E
b) F
c) G
d) H

### Programming Assignment 1.1

Write a program that reads in numbers m, n and prints the letter X (capital X) m times followed by the letter Y (capital Y) n times, all in one line. Don’t write the #include < simplecpp > statement at the beginning of your code, directly start the main_program

``````~~~THERE IS SOME INVISIBLE CODE HERE~~~

int main(){
int m,n;
cin>>m>>n;

while(m--){
cout<<"X";
}

while(n--){
cout<<"Y";
}
}``````

### Programming Assignment 1.2

Write a program that reads in a number m and prints a ‘*’ on m consecutive lines, followed by m+1 ‘*’s on a single line.  The result should look like the letter L made out of stars. You can go to a new line in the output using cout << endl; .Don’t write the #include < simplecpp > statement at the beginning of your code, directly start the main_program

``````~~~THERE IS SOME INVISIBLE CODE HERE~~~

int main() {
int m;
cin>>m;

int a = m;

while(a--) {
cout<<"*"<<endl;
}

int b=m+1;

while(b--) {
cout<<"*";
}

}``````

<< Prev- An Introduction to Programming Through C++ Week 0 Solutions

>> Next- An Introduction to Programming Through C++ Week 2 Solutions

Programming in Java NPTEL week 1 quiz answers

Nptel – Deep Learning assignment solutions

NPTEL answers: Programming in Modern C++

The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly inform us. Donâ€™t forget to provide the appropriate URL along with error description. So that we can easily correct it.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

### 5 thoughts on “An Introduction to Programming Through C++ | NPTEL 2022 | Week 1 Assignment Answers”

1. int main()
{
int i,m,n;
cin>> m;
for(i=0;i<m;i++)
{
cout<>n;
for(i=0;i<n;i++)
{
cout<<"Y";
}
return 0;
}