Press ESC to close

CS201 Mcqs MidTerm

The provided document is focused on CS-201 Introduction to Programming, specifically for the Mid-Term MCQs, with solutions. Here’s an overview of the main topics covered in these notes:

  1. Basic Syntax and Declaration:

    • Topics include the correct syntax for declaring variables, arrays, and pointers. Several questions focus on basic operations like pointer declarations, constant pointers, array declarations, and memory allocation for arrays and pointers.
  2. Control Structures:

    • The document tests knowledge of control structures like if-else, switch, loops (for, while, do-while), and how they are applied in programs. Special attention is given to the behavior of loops, switch cases, and conditional expressions.
  3. File I/O (Input/Output) Operations:

    • Several questions address file handling in C++, focusing on opening files in various modes (ios::in, ios::out), the use of streams (ifstream, ofstream), and file operations like reading, writing, and closing files.
  4. Pointers and Memory Management:

    • Pointers are a major focus, with questions on pointer arithmetic, pointer-to-pointer, dereferencing pointers, and their use in dynamic memory management.
    • The concepts of sizeof() operator, dereferencing, and pointer operations are discussed thoroughly.
  5. Functions:

    • This section emphasizes function prototypes, call-by-value and call-by-reference methods, return types, and how functions handle arguments passed to them. Topics include how to return values from functions and correct function declarations.
  6. Operators:

    • A detailed exploration of operators such as logical operators (&&, ||), arithmetic operators (+, -, *, /), modulus (%), relational operators, and their precedence in expressions is presented. The notes test understanding of how expressions are evaluated in terms of order of precedence.
  7. Data Types and Strings:

    • Different data types (integers, floats, chars) and their usage in C++ programs are covered.
    • The handling of strings in C++ using character arrays, the \0 null-terminator, and string manipulation functions like strcpy, strlen, and strcat are discussed.
  8. Structures and Arrays:

    • Structures in C++, including the use of arrays and multi-dimensional arrays, are discussed.
    • Specific focus is given to accessing and manipulating elements of arrays, both one-dimensional and multi-dimensional.
  9. Miscellaneous Concepts:

    • Some additional concepts include error handling (syntax vs logical errors), memory management (heap vs stack), and C++ keywords like const and volatile.
    • A few questions also relate to the history of programming languages like the development of C and its relation to UNIX.

The notes provide solutions that are mostly multiple-choice questions aimed at reinforcing the understanding of core programming concepts, especially in C++.

These topics are essential for a fundamental understanding of programming, focusing on syntax, logic, data manipulation, memory management, and problem-solving using C++.

Leave a Reply

Your email address will not be published. Required fields are marked *