YOUR SUBJECT CS201 Introduction to ProgrammingChange subject ↗
PRACTICE AT YOUR OWN PACE

CS201 practice questions

Think through the options before revealing the answer. Use the term filter to focus your revision.

86 questions
CS201 · Midterm#36

Header file: fstream.h includes the definition of the stream classes __________.

  1. A
    ifstream, fstream, cout
  2. B
    ifstream, fstream, ofstream
  3. C
    fstream, cin, cout
  4. D
    None of the above
Show correct answer

Correct answer: A. ifstream, fstream, cout

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#35

In if structure the block of statements is executed only,

  1. A
    When the condition is false
  2. B
    When it contain arithmetic operators
  3. C
    When it contain logical operators
  4. D
    When the condition is true
Show correct answer

Correct answer: D. When the condition is true

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#34

A Matrix can be composed of ints, floats or doubles as their elements. Best way is to handle this ,_______________

  1. A
    Write a separate class to handle each
  2. B
    Use templates
  3. C
    Use strings to store all types
  4. D
    None of the given options
Show correct answer

Correct answer: B. Use templates

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#33

Templates are not type safe.

  1. A
    true
  2. B
    false
Show correct answer

Correct answer: B. false

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#32

width() is member function of _____________

  1. A
    cin object
  2. B
    cout object
  3. C
    Both cin and cout object
  4. D
    None of the given option
Show correct answer

Correct answer: C. Both cin and cout object

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#31

The function free() returns back the allocated memory got thorough calloc and malloc to _____ .

  1. A
    stack
  2. B
    heap
  3. C
    stack and heap
  4. D
    None of the given options
Show correct answer

Correct answer: B. heap

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#30

Which of the following function do NOT initialize the chunk of memory to all zero?

  1. A
    calloc() function
  2. B
    Both malloc() and calloc()
  3. C
    None of the above
  4. D
    malloc() function
Show correct answer

Correct answer: D. malloc() function

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#29

The appropriate data type to store the number of rows and colums of the matrix is____________.

  1. A
    int
  2. B
    float
  3. C
    char
  4. D
    none of the given options
Show correct answer

Correct answer: A. int

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#28

When ever dynamic memory allocation is made in C/C++, it is freed_____________.

  1. A
    Explicitly
  2. B
    Implicitly
  3. C
    Both explicitly and implicitly
  4. D
    None of the given options
Show correct answer

Correct answer: A. Explicitly

Check community answers against your course notes.Question permalink ↗
CS201 · Midterm#27

Assignment operator is -------------------------associative.

  1. A
    right
  2. B
    left
  3. C
    binary
  4. D
    unary
Show correct answer

Correct answer: A. right

Check community answers against your course notes.Question permalink ↗