Select Your Subject Code

CS - Computer Science MGT MTH ECO ENG STA PAK PHY ACC
CS001 CS408 CS602 CS619 CS710 CS724 MGT101 MGT501 MGT610 MTH001 MTH603 ECO401 ENG001 STA301 PAK301 PHY101 ACC311
CS101 CS410 CS604 CS701 CS711 CS726 MGT201 MGT502 MGT611 MTH100 MTH201 ECO402 ENG101 STA630 PAK302 PHY301 ACC501
CS201 CS501 CS605 CS702 CS712 CS305 MGT211 MGT503 MGT613 MTH101 MTH203 ECO403 ENG201 STA730


CS301 CS502 CS606 CS703 CS713 CS411 MGT301 MGT510 MGT619 MTH202 MTH311 ECO404 ENG301



CS302 CS504 CS607 CS704 CS716 CS412 MGT401 MGT520 MGT620 MTH301 MTH502 ECO406 ENG401



CS304 CS506 CS609 CS706 CS718 CS413 MGT402 MGT601 MGT703 MTH302
ECO704




CS401 CS507 CS610 CS707 CS720 CS509 MGT404 MGT602 MGT704 MTH401
ECO501




CS402 CS508 CS614 CS708 CS721 CS621 MGT411 MGT603 MGT705 MTH501






CS403 CS601 CS615 CS709 CS723 CS622 MGT501 MGT604 MGT711 MTH601
Showing posts with label Cs201. Show all posts
Showing posts with label Cs201. Show all posts

CS201 Most Important Questions for VIVA

By: // No comments:

CS201 Most Important Questions for VIVA 

Here we have for You Most important and frequently Asked Cs201 viva questions with Answer. Read them All for Good Preparation of CS201 VIVA.

You should also Read: CS201 VIVA Preparation Helping Material

What is C++?
C++ is created by Bjarne Stroustrup of AT&T Bell Labs as an extension of C, C++ is an object-oriented computer language used in the development of enterprise and commercial applications. Microsoft’s Visual C++ became the premier language of choice among developers and programmers.

What are the basic concepts of object oriented programming?
It is necessary to understand some of the concepts used extensively in object oriented programming.These include
§ Objects
§ Classes
§ Data abstraction and encapsulation
§ Inheritance
§ Polymorphism
§ Dynamic Binding
§ Message passing

Define inheritance?
The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch. Inheritance is the process by which objects of one class acquire properties of objects of another class.

Define Polymorphism?

Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviors in different instances.

What are the features of C++ different from C?
§ All the features of C are similar to C++ except some features, such as polymorphism, operator overloading which are supported in C++ but not in C language.
§ Both C and C++ language is similar in their functionality but C++ provides with more tools and options.

What is encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.

What is message passing?
An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.

What are tokens in C++?
The smallest individual units of a program is known as tokens. c++ has the following tokens :
§ Keywords
§ Identifiers
§ Constants
§ Strings
§ Operators

What is the use of enumerated data type?
An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.

Also Read: CS201 Solved Subjective Midterm Past Paper - 2009


What is the use of default constructor?
A constructors that accepts no parameters is called the default constructor.If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameter-less constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.

Define Constructors?
A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.

How variable declaration in c++ differs that in c?
C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.

Define destuctors?
§ A destructor is called for a class object when that object passes out of scope or is explicitly deleted.
§ A destructor as the name implies is used to destroy the objects that have been created by a constructors.
§ Like a constructor , the destructor is a member function whose name is the same as the class name but is preceded by a tilde.

What is a class?
A class is a collection of objects.

what is the difference between c &c++?
• C++ is an object oriented programing but C is a procedure oriented programing.
• C is super set of C++.
• C can’t support inheritance, function overloading, method overloading etc. but c++ can do this.
• In c program the main function could not return a value but in the c++ the main function should return a value.

What are the few advantages of Inline function?
§ It offers an improved macro facility.
§ By using the inline functions, the user can split a large function with many nested modules of statement blocks into many small inline functions.

Also Read: CS201 Solved Subjective Midterm Paper 2011

What is copy constructor?
Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.

What is default constructor?
A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.

What is a scope resolution operator?
The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

What is the difference between Object and Instance?
§ An instance of a user-defined type is called an object. We can instantiate many objects from one class.
§ An object is an instance of a class.

What is the difference between macro and inline?
Inline follows strict parameter type checking, macros do not.
Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.

How variable declaration in c++ differs that in c?
C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.

What is multiple inheritance?
A class can inherit properties from more than one class which is known as multiple inheritance.

what is the use of virtual destructor in c++?
§ A destructor is automatically called when the object is destroyed.
§ A virtual destructor in C++ is used primarily to prevent resource leaks by performing a clean-up of the object.

What do you mean by reference variable in c++?
A reference variable provides an alias to a previously defined variable.
Data -type & reference-name = variable name

What is iterator class?
§ Iterator class provides an access to the class which are inside the containers(it holds a group of objects in an organized way).
§ The containers include the data structure, class and abstract data type.

What are the types of declarations in C++?
There are so many types of declaration in C++ are :
§ Variable declaration
§ Constant declaration
§ Function declaration
§ Object declaration

What are Smart pointers?
Smart pointers are almost similar to pointers with additional features such as automatic destruction of a variable when it becomes out of scope and the throwing of exceptions that ensures the proper destruction of the dynamically allocated objects.

Explain function template?
Function template provides a means to write generic functions for different data types such as integer, long, float or user defined objects.

Explain class template?
Class template provides a means to write a generic class for different types so that a class can have members based on generic types that do not need to be defined at the moment of creating the class or whose members use these generic types.

What is difference between function overloading and operator overloading?
A function is overloaded when same name is given to different function.
While overloading a function, the return type of the functions need to be the same.

Also Read: CS 201 solved midterm Past Papers Download 2015

What are the advantages of inheritance?
§ Code re-usability
§ Saves time in program development.

What is a dynamic constructor?
§ The constructor can also be used to allocate memory while creating objects.
§ Allocation of memory to objects at the time of their construction is known as dynamic construction of objects.
§ The memory is allocated with the help of the new operator.

What is the difference between an Array and a List?
The main difference between an array and a list is how they internally store the data. whereas Array is collection of homogeneous elements. List is collection of heterogeneous elements.

What is the use of ‘using’ declaration?
A using declaration makes it possible to use a name from a namespace.

What is the difference between a template class and class template?
Template class: A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.
Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.

What is friend function?
§ The function declaration should be preceded by the keyword friend.
§ The function definitions does not use either the keyword or the scope operator ::
§ The functions that are declared with the keyword friend as friend function.
§ Thus, a friend function is an ordinary function or a member of another class.

What is a scope resolution operator?
A scope resolution operator can be used to define the member functions of a class outside the class.

What do you mean by pure virtual functions?
A pure virtual member function is a member function that the base class forces derived classes to provide. Any class containing any pure virtual function cannot be used to create object of its own type.

What is a conversion constructor?
§ A converting constructor is a single-parameter constructor that is declared without the function specifier explicit.
§ The compiler uses converting constructors to convert objects from the type of the first parameter to the type of the converting constructor’s class.

What is a container class? What are the types of container classes
§ A container class is a class that is used to hold objects in memory or external storage.
§ A container class acts as a generic holder.
§ A container class has a predefined behavior and a well known interface.
§ A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory.
§ When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.

What is Associative container?
Associative containers are designed to support direct access to elements using keys. They are not sequential. There are four types of associative containers :
§ Set
§ Multiset
§ Map
§ Multimap

What is an iterator?
Iterators are like pointers. They are used to access the elements of containers thus providing a link between algorithms and containers. Iterators are defined for specific containers and used as arguments to algorithms.

What are the defining traits of an object-oriented language?
The defining traits of an object-oriented language are:
§ Encapsulation
§ Inheritance
§ Polymorphism

Also Read: CS201 Latest Solved MCQs (23 to 45 Lectures)

What is this pointer?
It is a pointer that points to the current object. This can be used to access the members of the current object with the help of the arrow operator.

Name some pure object oriented languages?
§ Smalltalk
§ Java
§ Eiffel
§ Sather

What is encapsulation?
Encapsulation (or information hiding) is the process of combining data and functions into a single unit called class.

What is problem with Run-time type identification?
The run time type identification comes at a cost of performance penalty. Compiler maintains the class.

What are the differences between new and malloc?
§ New initializes the allocated memory by calling the constructor. Memory allocated with new should be released with delete.
§ Malloc allocates uninitialized memory.
§ The allocated memory has to be released with free.new automatically calls the constructor while malloc(dosen’t)

What is conversion operator?
You can define a member function of a class, called a conversion function, that converts from the type of its class to another specified type.

What do you mean by implicit conversion?
§ Whenever data types are mixed in an expression then c++ performs the conversion automatically.
§ Here smaller type is converted to wider type.
§ Example : in case of integer and float integer is converted into float type.

What are virtual functions?
§ The virtual functions must be members of some class.
§ They cannot be static members.
§ They are accessed by using object pointers.
§ A virtual function can be a friend of another class.

What is the main purpose of overloading operators?
§ The main purpose of operator overloading is to minimize the chances of occurrence of errors in a class that is using the overload operators.
§ It also helps in redefining the functionalities of the operators to improve their performance.
§ Operator overloading also makes the program clearer, readable and more understandable by using common operators, such as +, =, and [].

What is a friend?
Friends can be either functions or other classes. The class grants friends unlimited access privileges.

What is stack unwinding?
Stack unwinding is a process in which a destructor is invoked in a particular program for destroying all the local objects in the stack between throwing and catching of an exception.

What is the form of assignment statement?
Variable = expression ( or constant )

What is the main purpose of overloading operators?
The main purpose of operator overloading is to minimize the chances of occurrence of errors in a class that is using the overloaded operators.

Also Read: Write ALLAH Using C++ Program

What is this pointer?
When a member function is invoked, the invoking objects pointer is passed implicitly as an argument. This pointer is called this pointer.

What is scope resolution operator?
The Scope resolution operator(: can be used to define the member functions of a program outside the boundary of a class and not within the class specifier.

What are static members and static functions?
Static members are
§ Created and initialized only once.
§ Shared among all the class objects.
Static functions are
§ Similar to the static variables and are associated with the class.
§ Can only access static variables of a class.
§ Can also be called using the scope resolution operator.

What are the components of a class?
A class consists of two components,
§ Data members
§ Methods

What is the advantage of using templates?
• Templates provide a means to write generic functions and classes for different data types.
• Templates are sometimes called parameterized types.
• Templates can significantly reduce source code size and increase code flexibility without reducing type safety.

Can a function overloading depend only on passing by value and passing by reference?
No, the reason is that whether a function is called the passing a parameter as a value or by reference, it appears similar to the caller of the function.

Is it possible to use a new for the reallocation of pointers?
The reallocation of pointers cannot be done by using new. It can be done by using the realloc() operator.

What are data members?
Data members are variables of any type(in-built or user defined).

What are the types of statements in c++?
A program in any language basically consists of statements. Statements symbolize instructions. There are many categories of statements.
§ Expression statement
§ Assignment statement
§ Selection statement
§ Iteration statement
§ Jump statement

What is initialization?
Initialization is a process of assigning a value to a variable at the time of declaration.

Also Read: cs201 final term solved paper mega File

Explain copy constructor?
A copy constructor is a special type of constructor which initializes all the data members of the newly created object by copying the contents of an existing object. The compiler provides a default copy constructor.
Class_name new _ object ( existing object);

What are the advantages of operator overloading?
Operator overloading is used to provide some extra features, behaviors and abilities to the users of a particular class. This feature in C++ helps in controlling the functions performed by an operator and reduces the chance of occurrence of errors in a program.

What is a dangling pointer?
When the location of the deallocated memory is pointed by the pointer even after the deletion or allocation of objects is done, without the modification in the value of the pointer, then this type of pointer is called a dangling pointer.

What is the difference between prefix and postfix versions of operator++()?
§ The prefix and postfix versions of operator ++() can be differentiated on the basis of arguments defined.
§ The postfix operator ++() consists of a dummy parameter of int datatype; whereas, a dummy parameter is not found in the prefix operator ++().

Can a static member function access member variable of an object?
No, because to access the member variable of an object inside its member function, this pointer is required. Since static functions are class functions, this pointer will not be passed as its arguments.

What is the advantages of using the Inline function?
§ An inline keyword before a function suggests the compiler to insert the complete body of the function wherever that function is invoked.
§ Inline expansion is typically used to eliminate the inherent cost involved in calling a function.
§ It is typically used for functions that need quick execution.

What are all the operators that cannot be overloaded?
§ Direct member access operator
§ De–reference pointer to class member operator.*
§ Scope resolution operator::
§ Conditional operator ?:
§ Sizeof operator sizeof

Can a function be overloaded based on return types?
Function signature does not depend on the return type. So overloading cannot be resolved by the return type alone.

What do you mean by a public member?
• A member declared as public is a public member.
• It can be accessed freely in a program.

Is recursion allowed in inline functions?
The recursion is allowed in inline function but practically, the inline functions and their properties do not remain inside the program. Moreover, the compiler is not sure about the depth of the recursion at the time of compilation.

What is virtual function?
A virtual function is a member function that is declared within a base class and redefined by a derived class .To create a virtual function, the function declaration in the base class is preceded by the keyword virtual.


How can a struct in C++ differs from a struct in C?

The differences between struct in C++ and C are listed in the following points:
• In C, the concept of inheritance is not supported. In C++, the concept of inheritance is fully supported.
• On declaring a struct in C, the addition of the struct keyword is must. On the contrary, there is no need of the struct keyword on declaring struct in C++.
• In C, the initialization cannot be done outside the scope of a structure. However, in C++, the initialization can be done outside the scope of a structure.
• In C, structures do not have direct functions or methods.

Also Read: Cs201 All Past Papers at one place

How the keyword struct is different from the keyword class in C++?
In C++, a class is similar to a struct with the exception that, by default, all the members of a class are private; while the members of a struct are public. Encapsulation is not supported by structures but supported by classes.

Define pure virtual function?
Pure virtual function is defined as a virtual function in a base class. It is implemented in a derived class. A program may not declare an instance of a class that has a pure virtual function.

Define a conversion constructor?
A conversion constructor is a single argument constructor. It is used by the compiler to convert a type of objects as an argument to a class type.


What is a default constructor?
A zero argument constructor or a constructor in which all the arguments have default values is called a default constructor.

What is difference between template and macro?
A template can be used to create a family of classes or function.A template describes a set of related classes or set of related functions in which a list of parameters in the declaration describe how the members of the set vary.
Identifiers that represent statements or expressions are called macros.

What is reference?
Reference is a name that acts as an alias, or alternative name, for a previously defined variable or an object.

What are the access specifier in c++?
There are three types of access specifier in c++ . They are
§ Public
§ protected
§ private

What is difference between C++ and Java?
§ C++ has pointers Java does not.
§ Java is the platform independent as it works on any type of operating systems.
§ java has no pointers where c ++ has pointers.
§ Java has garbage collection C++ does not.

What is namespace?
The C++ language provides a single global namespace. Namespaces allow to group entities like classes, objects and functions under a name.

What is an explicit constructor?
A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.Explicit constructors are simply constructors that cannot take part in an implicit conversion.

What is the use of storage class specifiers?
A storage class specifier is used to refine the declaration of a variable, a function, and parameters. The following are storage class specifiers :
§ auto
§ register
§ static
§ extern

what is the assignment operator in c++ and what is its function?
Equal sign '=' is the assignment operator in C++. Default assignment operator handles assigning one object to another of the same class. Member to member copy (shallow copy).

Can destructor be private?
Yes destructors can be private. But it is not advisable to have destructors as private.

What is strstream?
string-stream provides an interface to manipulate strings as if they were input/output streams.
‹strstream› to define several classes that support iostreams operations on sequences stored in an allocated array of char object.

What is the difference between method overloading and method overriding?
Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters).
Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

What is STL? And what are the components of STL?
A collection of generic classes and functions is called as Standard Template Library (STL). STL components are
• Containers
• Algorithm
• Iterators

You Can Also Download Cs201 Solved Final Term Papers, CS201 
Short Notes, CS201 Assignment Solutions, CS201 Lecture Wise Questions Answers Files, CS201 Solved MCQs, CS201 Solved Quiz , CS201 Solved Final Term Subjective Papers , CS201 Solved Final Term Objective Papers from Virtual Study Solutions For Preparation of Final Term Papers.

CS201 VIVA Preparation Helping Material

By: // No comments:

CS201 VIVA Preparation

Here You can Download Some Definitions and Helping material for CS201 VIVA Preparation for semester Fall 2016.

Also Read : CS201 Latest Solved MCQs For Final Term Papers

CS201 Some Definitions and Helping material for Viva

1. What is a program?
A program is a precise sequence of steps to solve a particular problem.

2. What is a class?
We write a C++ program using data members, and functions. We call this program “class”. 


3. What are data members?
The data members, functions and nested classes are called class members.

4. What is class layout?
The way in which data class members are arranged in a class object is called class layout.

5. What is class template?
A template is used for generating class types.

6. What is comment in Programing language?
Comments are used to explain the functioning of the programs. It helps to understand the code. C style of commenting is /*……..*/ also used in C++. And new line oriented C++ style is //………

7. What is a constructor?
A constructor initializes the data member of an object in the scope. It has no return type, and has the same name as class. We use many types of constructor by overloading them. 


Types of constructor:

  • Default constructor/compiler generated constructor 
  • Simple constructor (takes no arguments) 
  • Parameterized constructor (takes arguments) 
  • Constructor overloading 
  • Copy constructor 
8. What is destructor?
A function called when a class object goes out of scope. It cleans up the object, freeing resources like dynamic storage. The name of the destructor is the same as that of a class with preceding tilde sign (~). It could not be overloaded. It has no return type, and takes no argument.

9. Define #include?
The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with <…..> if the file is a system provided file, or in quotes “….” if the file is user provided.

10.For which purpose we use cout?
If we want to print something on the screen we use cout (Output stream) for this purpose.

CS201 Helping Material for Viva Preparation

CS201 LATEST SOLVED MCQS ATTACHMENTS# 1:

CS201-finalterm solved mcqs with ref. by Moaaz and Asad.pdf, 2.3 MB

CS201 LATEST SOLVED MCQS ATTACHMENTS# 2:

CS201-2008_solved.doc, 79 KB
CS201 2010.doc, 81 KB
CS201 - Final Term Papers 03.pdf, 91 KB

CS201 LATEST SOLVED MCQS ATTACHMENTS# 3:

CS201 - Final Term Papers 08.pdf, 101 KB
CS201 - Final Term Papers 09.pdf, 119 KB
CS201 - Final Term Papers 12.pdf, 116 KB

CS201 LATEST SOLVED MCQS ATTACHMENTS# 4:

CS201 - Subjective Questions 02.pdf, 61 KB
CS201 curent subjective solved.pdf, 219 KB

CS201 LATEST SOLVED MCQS ATTACHMENTS# 5:

CS201 Assignment no 3 Fall 2016

By: // No comments:

CS201 Assignment no 3 Fall 2016

Here we have CS201 - Introduction to Programming Assignment No. 3 Solution and Discussion Fall 2016 Due Date Jan 16, 2017. You Can Also Download Solved Final Term Papers, Short Notes, Assignment Solutions, Lecture Wise Questions Answers Files, Solved MCQs, Solved Quiz , Solved Final Term Subjective Papers , Solved Final Term Objective Papers from Virtual Study Solutions For Preparation of Final Term Papers.


Also Read: CS201 Latest Solved MCQs For Final Term Papers

CS201 Assignment no 3:

XYZ University needs a system for student’s courses and their semester details. A data entry operator needs to enter student’s data in to the system, and then the system will show the report of student semester information. Following data will be used by the system.
  • Course code
  • Course name
  • Semester
The system will allow entering data for five courses at a time and will input course code along with course name, later the system will format the report in a more readable form.

Also Read: CS201 Solved Final Term Past Papers Collection

CS201 Assignment no 3 Question:

Your task is to:
Write a C++ program to implement the above mentioned interface

  1. Your program should provide the user with options to enter data for courses along with course code. e.g.
  2. Enter course name along with course code: CS201 Introduction to Programming
  3. After taking course information from user your program should prompt user to enter semester information.
e.g. Enter Semester: Fall 2016
  • The program should input data for five courses and semester.
  • Use structure name “course” in your program. 
  • Use separate functions for taking user inputs, displaying and formatting outputs. 
e.g. Input Courses(),Display Header(),Display Courses(),Format Course(---) etc.

Note: Use structure to implement above program, no credit will be awarded if structure is not used.

Also Read: Virtual University (VU) Exams Pattern

CS201 Assignment No. 3 Solution:

If you want to Get the Solution Directly in Your Inbox. Subscribe us below and save your self Trouble of Searching Assignment Solution.


CS201 Assignment Solution solved.rar, 72 KB

CS201 Solved Subjective Midterm Past Paper - 2009

By: // No comments:

CS201- SOLVED SUBJECTIVE MIDTERM PAPERS

Here is the Complete Collection of CS201 Solved subjective Midterm Paper of 2009. You Can Also Download CS201 Solved Mid Term Papers, CS201 Short Notes, CS201 Lecture Wise Questions Answers Files, CS201 Solved MCQs, CS201 Solved Quizzes , CS201 Solved Mid Term Subjective Papers , CS201 Solved Mid Term Objective Papers From the Links given at the end of this Post.

CS201 MIDTERM PAPER0 - 2009

Here is the CS201 Mid term Paper of 2009 Examination:

CS201 Midterm Question No. 1:

( Marks: 1 )

To Which category of the software “Compiler and Interpreter” belongs?

Answer: (page 11)

The compilers and interpreters also belong to the System Software category.

CS201 Midterm Question No. 2:

( Marks: 1 )

What is the result of the expression x = 2 + 3 * 4 – 4 / 2

12

first multiplies 3*4 = 12 then Division 4/2 = 2

2+12-2 = 12

Also Read: Cs201 old mid term paper - 2015

CS201 Midterm Question No. 3:

( Marks: 2 )

Write a declaration statement for an array of 10 elements of type float. Include an initialization statement of

the first four elements to 1.0, 2.0, 3.0 and 4.0.

Answer:

float tmp [10] = {1.0,2.0,3.0,4.0};

CS201 Midterm Question No. 4:

( Marks: 3 )

Write down the output of the following code?

int array[7], sum = 0;

for(int i=0;i

{

array[i] = i;

sum+= array[i];

}

cout<< “ Sum = “ <

Answer:21

Loop will run times starts from zero and add values from 1 to 6 which is equal to 21

Also Read: CS 201 all past solved midterm papers 2015

CS201 Midterm Question No. 5:

What will be the output of the following segment of C++ code?

int A[5] = {1 , 2, 3, 4};

int i;

for (i=0; i

{

A[i] = 2*A[i];

cout << A[i] << " ";

}

Answer:

2 4 6 8 0

Loops will run 5 times as its starting from zero. It will multiply the value of each item in array as last time

is not initialized so it will multiply it with zero to give zero as output

CS201 Midterm Question No. 6:

( Marks: 10 )

Write a C++ program that will determine if a departmental store customer has exceeded the credit

limit on a charge account.

Program should input the following facts in five variables

1. Account number

2. Balance at the beginning of month (Beginning balance)

3. total of all items charged by customer this month (charges)

4. total of all credits (credits)

5. allowed credit limit

Calculate the new balance

New balance = Beginning balance + charges – credits

Determine if new balance exceeds the allowed credit limit. For those customers whose credit limit is

exceeded. The program should display the message “Credit Limit exceeded.”

Also Read: CS201 INTRODUCTION TO PROGRAMMING PREVIOUS MIDTERM PAPER 2013

CS201 Midterm Question No. 7:

( Marks: 1 )

Which programming tool is helpful in tracing the logical errors?

Answer: (page 13)

Debugger is used to debug the program i.e. to correct the logical errors.

CS201 Midterm Question No. 8:

 
( Marks: 1 )

Give the syntax of opening file ‘myFile.txt’ with ‘app’ mode using ofstream variable ‘out’.

Answer: (page 203)

out.open(“myfile.txt” , ios::app);

Also Read: CS201 Introduction to Programming Short Notes

CS201 Midterm Question No. 9:

( Marks: 2 )

What is the difference between switch statement and if statement.

Answer:

The if statement is used to select among two alternatives. It uses a boolean expression to decide

which alternative should be executed. The switch statement is used to select among multiple

alternatives. It uses an int expression to determine which alternative should be executed.

CS201 Midterm Question No. 10:

( Marks: 3 )

Identify the errors in the following code segment and give the reason of errors.

main(){

int x = 10

const int *ptr = &x ;

*ptr = 5 ;

}

Answer:

*ptr = 5;

declaring a pointer to a constant Integer. You cannot use this pointer to change the value being

pointed to: 

CS201 Midterm Question No. 11:

( Marks: 5 )

If int array[10]; is an integer array then write the statements which will store values at Fifth and

Ninth location of this array,

Answer:

arrary[4] = 200;

arrary[8] = 300;

CS201 Midterm Question No. 12:

( Marks: 10 )

Write a function BatsmanAvg which calculate the average of a player (Batsman), Call this function

in main program (Function). Take the input of Total Runs made and Total number of matches

played from the user in main function

#include // allows program to output data to the screen

// function main begins program execution

int BatsmanAvg(int TotalRuns, int TotalMatches) ;

main()

{

int stopit;

int TotalRuns, TotalMatchesPlayed =0;

cout << "Please Entere the total Runs made : " ;

cin>> TotalRuns ;

cout << "Please Entere the total match played : " ;

cin>> TotalMatchesPlayed ;

cout << "\n Avg Runs = " << BatsmanAvg(TotalRuns,TotalMatchesPlayed);

cin>> stopit; //pause screen to show output

}

int BatsmanAvg(int TotalRuns, int TotalMatches)

{

return TotalRuns/TotalMatches;

}

Also Read: CS201 Latest Solved MCQs (23 to 45 Lectures)

CS201 Midterm Question No. 13:

( Marks: 1 )__________

What is the output of the following program?

#include iostream.h

main ( ) {

int RollNo;

int rollno;

RollNo = 5;

rollno = 8;

cout << “Roll No is ” << rollno; }

Answer:

Program should not compile due to missing <> from following statement

#include iostream.h


if we ignore this then output should be

Roll No is 8

CS201 Midterm Question No. 14:

( Marks: 1 )_____________________

Why we include iostream.h in our programs?

Answer: page 15

iostream.h tells the C compiler to include the contents of a file, This is the name of the library

definition file for all Input Output Streams.

Also Read: MTH202 Midterm Solved - Unsolved Past Papers

CS201 Midterm Question No. 15:

( Marks: 2 )

Find out error in the code given below:

if ( num % 2 = 0 )

cout << "The number is even" << endl;

Answer:

if ( num % 2 = 0 ) There should be extra = sign following is right statement

if ( num % 2 = =0 )

CS201 Midterm Question No. 16:

( Marks: 3 )

How learning to design programs is like learning to play soccer?

Answer: (page 6)

“Learning to design programs is like learning to play soccer. A player must learn to trap a ball, to dribble

with a ball, to pass, and to shoot a ball. Once the player knows those basic skills, the next goals are to learn

to play a position, to play certain strategies, to choose among feasible strategies, and, on occasion, to create

variations of a strategy because none fits. “

Also Read : ISL 201 Mid term SOlved Papers

CS201 Midterm Question No. 17:

( Marks: 5 )

Write the procedure of data insertion in middle of the files by Merge Method practiced in older systems?

Answer: (page 218)

· Opened the data file and a new empty file.

· Started reading the data file from beginning of it.

· Kept on copying the read data into the new file until the location we want to insert data into is reached.

· Inserted (appended) new data in the new file.

· Skipped or jumped the data in the data file that is to be overwritten or replaced.

· Copied (appended) the remaining part of the file at the end of the new file

CS201 Midterm Question No. 18:

( Marks: 10 )

Write a recursive function that takes three arguments (an integer array, starting subscript ‘s’ and

ending subscript ‘e’ ).

In first recursive call, the function should display the array from subscript ‘s’ (s = 0) to ‘e’ (e =

size of array). In each successive call, the function should print the array from index s+1 to e. T

function should stop processing and return when starting subscript becomes equal to ending

subscript.

For example, if user enters values for array 2, 3, 4, 5, 6 then the recursive function must display the

following output.

2 3 4 5 6

3 4 5 6

4 5 6

5 6

6

Answer:

#include ;

void PrintArray(int arrayInput[], int &s, int &e);

main ( )

{

int pause;

int TestArray [6] = {1,2,3,4,5,6};

int StartPoint = 0;

int EndPoint = 5;

PrintArray(TestArray , StartPoint, EndPoint);

cout<<"\n";

PrintArray(TestArray , StartPoint, EndPoint);

cout<<"\n";

PrintArray(TestArray , StartPoint, EndPoint);

cout<<"\n";

PrintArray(TestArray , StartPoint, EndPoint);

cout<<"\n";

PrintArray(TestArray , StartPoint, EndPoint);

cout<<"\n";

PrintArray(TestArray , StartPoint, EndPoint);

cin >> pause;

}

void PrintArray(int arrayInput[], int& s, int& e)

{

for (int i = s; i<= e; i++)

{

cout<< arrayInput[i];

}

s=s+1;

}

CS201 Midterm Question No. 19:

( Marks: 1 )

Suppose ‘z’ is a variable of type int. What will be the result of x = 27/4:

CS201 Midterm Question No. 20:

( Marks: 1 )

Give the general syntax of definition of structure.

Answer: repeat

Question No: 19 ( Marks: 2 )

Consider the structure

struct Customer

{

int custnum;

int salary;

float commission;

};

A programmer wants to assign 2000 for the structure member salary in the above example of

structure Customer with structure variable cust1 What line of code should he write

CS201 Midterm Question No. 21:

( Marks: 3 )

What is compiler?

Answer: repeat

CS201 Midterm Question No. 22:

( Marks: 5 )

What is the difference between while and for loop?

Answer:

when number of iterations known we use for loop otherwise we will use while loop

CS201 Midterm Question No. 23:

( Marks: 10 )

Write a void function( ); that takes integer numbers from the user and then displays the sum of

odd and even numbers entered by the user. Your program should terminate if user enters a

negative number

Thanks for Reading. Subscribe Below To recieve CS201 Papers in Your Mail box. or You can Like our facebook Page.

CS201 Solved Subjective Midterm Paper 2011

By: // No comments:

CS201- Solved Subjective Midterm Paper

Here is the Complete Collection of CS201 Solved subjective Midterm Paper of May/10/2011. You Can Also Download CS201 Solved Mid Term Papers, CS201 Short Notes, CS201 Lecture Wise Questions Answers Files, CS201 Solved MCQs, CS201 Solved Quizzes , CS201 Solved Mid Term Subjective Papers , CS201 Solved Mid Term Objective Papers From the Links given at the end of this Post.

CS201 Solved Subjective Midterm Paper 2011

CS201 MIDTERM EXAMINATION - Lectures 1-22

CS201 Midterm Paper Question No. 1:


( Marks: 2 )

What is the difference between switch statement and if statement.

Answer:

1.if statement is used when we have to check two conditions while switch is a multi conditional control statement

2. SWITCH statement can be executed with all cases if the “break” statement is not used whereas IF statement has to be true

to be executed further.

CS201 Midterm Paper Question No. 2:

( Marks: 2 )

Why we close a file after use?

Answer:

To save our data stored on file. Also this process makes our program fast and reliable.

OR

You have finished with it. This is particularly important if you are writing to the file. The operating system does not switch on the

disk drive to write just a single character to the disk, rather it waits until it has a load to write and then writes the lots in one go.

CS201 Midterm Paper Question No. 3:

( Marks: 2 )

A two-dimensional array has 3 rows and 4 columns. Write down the syntax to initialize first element of all

three rows of two-dimensional array with value 2.

Answer:

int matrix[0][0]=2

int matrix[1][0]=2

int matrix[2][0]=2

CS201 Midterm Paper Question No. 4:

Identify the errors in the following code segment and give the reason of errors.

main(){

int x = 10

const int *ptr = &x ;

*ptr = 5 ;

}

Answer:

Int x=10….No ending semicolon.

*ptr=5... Declaring a pointer to constant integer. You cannot use this pointer to change the value being

pointed to.

CS201 Midterm Paper Question No. 5:


Can you use an assignment operator to assign the value of one C-string to another?

Answer:

Yes we can assign the one value of C-string to another using assignment operator. We can

assign the value of one string to another string through this method.

A[0]=B[0]

A[1]=B[2]

A[3]=B[3]

And we can assign the whole string to another C string using Assignment operator by using loops.

CS201 Midterm Paper Question No. 6:

Why binary search algorithm is more efficient than the linear search algorithm?

Answer: (page118)

Binary search algorithm is more efficient than liner algorithm because the arrays are sorted in asending or

desending order and we use “devide and conqrer” technique. In binary search each iteration reduces the

search by the factor of two but in the linear we have the same number of searches as we have the number of

elements.e.g,if we have array of 1000 elements the linear search will take 1000 iterations however binary

search will take max 10.

CS201 Midterm Paper Question No. 7:

( Marks: 5 )

Write down the output of the code given below :

Hint:

Size of char is 1 byte

Size of int is 2 byte

Size of float is 4 byte

#include

union mytypes_t {

char c;

int i;

float f;

} mytypes;

int main(){


mytypes.c = 'H';

mytypes.i = 15;


cout << sizeof(mytypes)<


mytypes.i = 15;

mytypes.c = 'H';


cout << sizeof(mytypes)<

system("PAUSE");

return 0;

}

CS201 Midterm Paper Question No. 8:

( Marks: 1 ) 
Please choose one

In Program commenting the code liberally is

Answer: (page 06)

It need to be self-contained and understandable. Comments should be placed liberally. The comments

should explain the logic, not the mechanics. Try to avoid fancy programming.

CS201 Midterm Paper Question No. 9:


Which header file must be included while handling files?

Answer: (page 199)

Include

CS201 Midterm Paper Question No. 10:

 ( Marks: 1 )

What is meant by C++ statement: const int *ptr = &x;

Answer:

ptr is a pointer to data of type const int type. And to assign the address of x to pointer ptr

CS201 Mid Term Past Papers: 

CS201 Midterm Paper Question No. 11:

( Marks: 2 )

What is a truth Table?

Answer: (page 562)

We know the concept of truth table. The truth tables are very important. These are still a tool available for

analyzing logical expressions. We will read logic design in future, which is actually to do with chips and

gate. We find it difficult to evaluate a complicated logical expression. Sometimes the logic becomes

extremely complicated so that even writing it as a simple syntax statement in any language. These are used to

make a big circuit with the use of minimum chips. These minimization techniques deal with Boolean algebra i.e.

logic.

CS201 Midterm Paper Question No. 12:

( Marks: 3 )

(1) An array day is declared as: int day[] = {1, 2, 3, 4, 5, 6, 7};

How many elements does array 'day' has?

Answer:

7 elements

(2) If the declaration is changed as: int day[7] = {1, 2, 3, 4, 5, 6, 7};

How many elements does array 'day' has?

Answer:

7 elements

CS201 Midterm Paper Question No. 13:

( Marks: 5 )

What are similarities and differences between Structures and Unions?

Answer: (page 242)

In structures, we have different data members and all of these have their own memory space. In union, the

memory location is same while the first data member is one name for that memory location. However, the

2nd data member is another name for the same location and so on. Consider the above union (i.e.

intOrChar) that contains an integer and a character as data members. What will be the size of this union?

The answer is the very simple. The union will be allocated the memory equal to that of the largest size data

member. If the int occupies four bytes on our system and char occupies one byte, the union intOrChar will

occupy four bytes

CS201 Midterm Paper Question No. 14:

what is the difference in pointer and veriable?

CS201 Midterm Paper Question No. 15:

what is the difference in tellg() and tellp()

Answer: Page 215

tellg () gives us the current get position of the file pointer, tellp () function is used to determine the next position to write a character

CS201 Midterm Paper Question No. 16:

why we close a file after use?

CS201 Midterm Paper Question No. 17:

call by value and call by reference?

Answer: Page 84-266

There is another way to call a function in which the function can change the values of variables that are passed as arguments, of

calling program. Such function call is known as call by reference.

Call by value means that when we call a function and pass some parameter to it, the calling function gets the

copy of the value and the original value remains unchanged.

CS201 Midterm Paper Question No. 18:

give one use of pointer

Answer: Page 150

The one use of pointer is to interchange two values that means it is used to swapped the values.

CS201 Midterm Paper Question No. 19:

bubble sort

Answer: Page 149

Bubble sorting is a technique, in which we put value of one variable in a temporary location to

preserve it and assign the value of second variable to the first. Then the temporary value is

assigned to the second variable

3. what happened when we increment pointer

The effect of the increment operator ++ on a pointer object is to have the new address to which it

points be the starting location of the object immediately after the object to which it previously

pointed.

CS201 Midterm Paper Question No. 20:

basic steps for file handling

Answer: Page 199

The basic steps of file handling are:

Open the file

Read and write

Close the file

Download CS 201 All Past Solved Midterm Papers

You can also Download CS 201 all past solved midterm papers from links below: