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#46

With template function, the compiler automatically detects the passed data and generates a new copy of function using passed data.

  1. A
    True Page
  2. B
    False
Show correct answer

Correct answer: A. True Page

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

Consider the following code segment. What will be the output of the following program?
int func(int) ;
int num = 10 ;
int main(){
int num ;
num = 5 ;
cout << num ;
cout << func(num) ;
}
int func(int x){
return num ;
}

  1. A
    5, 5
  2. B
    10, 5
  3. C
    5, 10
  4. D
    10, 10
Show correct answer

Correct answer: C. 5, 10

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

Which of the following is correct way to initialize a variable x of int type with value 10?

  1. A
    int x ; x = 10;
  2. B
    int x = 10;
  3. C
    int x, x = 10;
  4. D
    x = 10;
Show correct answer

Correct answer: B. int x = 10;

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

The normal source of cin object is,

  1. A
    File
  2. B
    Disk
  3. C
    Keyboard
  4. D
    RAM
Show correct answer

Correct answer: C. Keyboard

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

Function implementation of friend function must be defined outside the class.

  1. A
    True
  2. B
    False
Show correct answer

Correct answer: B. False

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

Friend function of a class is ______________ .

  1. A
    Member function
  2. B
    Non-member function
  3. C
    Private function
  4. D
    Public function
Show correct answer

Correct answer: B. Non-member function

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

The return type of operator function must always be void.

  1. A
    True
  2. B
    False
Show correct answer

Correct answer: B. False

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

Which kind of functions can access private member variables of a class?

  1. A
    Friend functions of the class
  2. B
    Private member functions of the class
  3. C
    Public member functions of the class
  4. D
    Friend, private and public functions
Show correct answer

Correct answer: A. Friend functions of the class

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

eof( ), bad( ), good( ), clear( ) all are manipulators.

  1. A
    True
  2. B
    False
Show correct answer

Correct answer: A. True

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

To access the data members of structure _______ is used.

  1. A
    dot operator (.)
  2. B
    * operator
  3. C
    U operator
  4. D
    None of given.
Show correct answer

Correct answer: A. dot operator (.)

Check community answers against your course notes.Question permalink ↗