Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Add your current paper

Views: 945

Replies to This Discussion

Today 26-05-2013 mid term  paper spring 2013 of cs201 ...

Q :  how the two dimensional array is related to the matrix .

Q : write a program in which you prompt the user to take 10 values in array and then display them ,sort the array and then find the maximum and minimum number in them .

Q : write a structure program and display all thees values

#include<iostream.h>

struct student{

char name[64];

int age;

int year;

char course[128];

};

hope so helpful 

Q : how the two dimensional array is related to the matrix .

Q : write a program in which you prompt the user to take 10 values in array and then display them ,sort the array and then find the maximum and minimum number in them .

Q : write a structure program and display all thees values

#include<iostream.h>

struct student{

char name[64];

int age;

int year;

char course[128];

};

) What happens when we use new and delete operator?
2) Question: Suppose an object of class A is declared as data member of class B.
(i) The constructor of which class will be called first? Answer A
(ii) The destructor of which class will be called first? Answer B(from past papers)
3) Write a program which defines five variables which store the salaries of five employees, using setw and setfill manipulators to display all these salaries in a column. Note: Display all data with in a particular width and the empty space should be filled with character x Output should be displayed as given below: (from past papers)
xxxxxx1000
xxxxxx1500
xxxxx20000
xxxxx30000
xxxxx60000

4)Overflow condition is used in repetition structure at which point it oocurs?
5)Is it possible to overlad operation for primitive data types.

6) Let we have a class,
class String
{
private: char buf[25];
}; Write code for assignment (=) operator function which assign one String object to other object. Your code should also avoid self assignment(from past paper)
7)What happen when an object is assigned to another object without overloading an assignment operator?
8)Write function name sum which accepts an integer as a argument in the function use a static variable to add the value passed to it as argument with each function call is the endl display the sum of value pass an argument:
9) Question No: 40 ( Marks: 10 ) Write a program which consists of two classes, Date and Person. Date class should contain three data members day , month , year and setter and getter function for these data members. Date class should also contain showdate() member function to display date.
Person class should contain three data members Name, Address, and Bday , where Name and Address are char pointer while Bday(Date of birth) is of type Date, Person class should further contain two member functions Display() and setdate().
CS201
Q1: (Marks 5) Write a program that defines a Template function named Add () which adds two numbers returns Sum. Define two variables of int type in the main and then call Add () function on that.
Output should be like this:
Adding numbers (don’t remember here what was written)
Enter first number:
12
Enter second number:
25
Sum=37
Q2: (Marks 5) Find the error in the program and then remove this. (Don’t remember the coding)
Q3: (Marks 5) Given the class Data
main()
{
class Date
{
private:
int day, month, year;
public:
day=01;
month=10;
year=2010
}
……………..Dont remember the lines
……………..
……………..
}
Use the dynamically allocation (don’t remember what)
In the last also free memory allocation.
Q4: (Marks 3) Why goto is not recommended to use in programmes?
Q5: (Marks 2) Write two types of data conversions used for used defined data types.
Q6: (Marks 2) Write the following using logical operators:
1. number is both multiple of 4 and 6
2. number is even but not 8
3. answer is either N or n
4. don’t remember this
Q7: (Marks 3) Write the output of the following if “int 5” is passed to the variable:
Template <class T);
T reciprocal (T x);
{
return (1/x);
}
(it was like something. Don’t remember exactly)
Q8: (Marks 3): How can we determine that dynamically memory allocation has been set successfully or not is C++ using the new operator?
Q.make a program using getline function
Q.make a program using template function select two floating point number and add them with add() function.(5)
Q.make a program take salary and pay tax of 5% if salary is less than 10,000 and pay 7% if the salary is greater than 10,000 using switch function.
Q.what are the function of new and delete ?
Q.what are the stream insertion overloaded operators?
Q Write a program which open a file name “this.txt” and then using write() function, writes the string “Introduction to Programming” at the end of the file.
Q What will be the output of the program:
Int x=10;
Int&y=x;
Y+=5;
Coutx;
Q 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.
Q How can we initialize an object which is created as constant data member in another class?
Q An array delare int day[]={1,2,3,4,5,6,7}
How many elements have?
If the declaration ofarray is changed to int days[7]={1,2,3,4,5,6,7}
How many elements have?

Comment by Follow Me 13 hours agoDelete Comment

My Paper

1) U Have given Sequential file sys and random file sys. What u prefer?

2) which loop check the condition in the end?

3)Which loop operate double in direction?

4) Which data type operation modulus operator `%`?

5)expression c is from

Right to Left or Left to Right

6)in c/c++ true and false are

0 and 1 or 0 and -1

7)Application software is used for

Solve an end user problem

8) How many elements can be stored in 3rows and 2 Columns?

9)pointer stores

memory Address

10)Accessibility of global variable is

anywhere in the program

11)if break statement is missed in a switch statement what will happen?



Read more: CS201 Introduction to Programming - Virtual University of Pakistan http://vustudents.ning.com/group/cs201introductiontoprogramming?com...

Subject:CS201 Introduction to programming 

Date:28-05-2013

total mcqs of 1MArks each: 20

Total short Subjective  Questions of 3Marks:2Total short subjective Questions

Q) Write the syntax for calling function string manipulation function which compare the first 5 character array "name" with string "asdf"?

Q))When a pointer isincremented then how many bytes will it move to change its address?

Q)Declare an integer array longroutes and pointer routrptr and assign the address of array longroutes to the pointer variable routeptr to the pointer?

Q)Find which is legal and illegal ?

Q) show the output of the following code:

main()

{char st[]="~This is -a sample string!";

char*pch;

pch=strtoklstr,",-s`";

while(pch!=Null)

coutPch;

pch=strtok(NULL,",-s~")

}

return 0;

}

CS201 Introduction to Programming

Today Midterm Paper (27-5-2013)

 

Bc090200975

 

Total Questions :26

20 Marks: 20 MCQ’S

2 Marks: 2 questions

3Marks: 2 questions

5Marks: 2 questions

 

  1. There is a pointer “ptr”of type int then address of which type of variable the ptr will store in it?

Variable of type char

Variable of type int

Variable of type double

Variable of type short

 

  1. Overflow condition occur when we try to assign a value to a variable which is _______

Less than its max size

Greater than its max size

Equal to

With in its range

 

  1. Which one of following statement is equal to x%=5?

x=%x5                         x=x%5             x=%5               x%=x5

 

  1. < , <=, >, >= are called ________ operators.

Logical Arithmetic                     Relational                     Conditional

 

  1. Correct way to initialize a character array ‘course’ with string “programming” is:

Course[12]=”programming”;

Course[]={”programming”};

 Course[]=’programming’;

 Course=”programming”;

 

  1. In c/c++ null cahracter is represented as:

\n                     \0                     \t                      \r

 

  1. To access the address of the variable ________ operator is used.

*

->

&&

&

 

  1. Afunction is a block of statements(codes) that can be ________

Defined repeatedly

Used limit no. of times

Defined once and used(call) as many times as required

Used only once

 

  1. In a return type of a function is void then it means that it will_______

Return any type of data

Return no data

Return some specific type of data                                              Return just char data

 

 

  1. C language was evolved from ________ language.

BASIC

FORTRAN

C++

B and BCPL

 

  1. The information stored in computer memory is ________

Volatile

Non-volatile

Redundant

Permanent

 

  1. A record is group of related ____________

Data

File

Bytes

Fields

 

  1. When accessing a structure member, the identifier to the left of the dot operator is the name of _________

A structure member

A tag

A variable

A keyword structure

 

  1. Stuctures are __________ allocation.

Heap

Queue

Stack

Cache

 

  1. An object of __________ class be created for saving the current possition of any opened file before reading from the file.

Filepos

Streampos

Stream

File stream

 

SUBJECTIVE PART:

 

How the two dimensional array is related to the matrix .2 MARKS

Assuming that “num” is a 2D array of character than what does statement *num contains? 2MARKS

 

 

Write a program in which you prompt the user to take 10 values in array and then display them ,sort the array and then find the maximum and minimum number in them . 3 MARKS

 

 

 

 

Write the output of the following: 5 MARKS

 

#include <iostream. h>

Union mytypes_t

{

            char c;

            int i;

            Float f;

}

mytypes;

 

int main();

{

 

            mytypes.c=’H’;

            mytypes.i=’15’;

 

coutsize of (mytypes)endl;

 

            mytypes.i=’15’;

            mytypes.c=’H’;

 

coutsize of (mytypes)endl;

 

return0;

 

}

 

 

Explain the logic of each statement:  5 MARKS

     Streampos orig=aFile,tellp();

     aFile.seekp(0.ios::end);

 

 

 

 

 

Loops:

A Computer is used for performing many Repetitive types of tasks The Process of Repeatedly performing tasks is known as looping . The Loop is that in which a task is repeated until the condition is true or we can say in the loop will Executes all the statements are until the given condition is not to be false.

 

There are the three types of loops in the java

while

do-while

for

 

all these are used for performing the repetitive tasks until the given condition is not true.

 

While:

While Loop is Known as Entry Controlled Loop because in The while loop first we initialize the value of variable or Starting point of Execution and then we check the condition and if the condition is true then it will execute the statements and then after it increments or decrements the value of a variable. But in the while loop if a Condition is false then it will never Executes.

 

 Do while:

- This is Also Called as Exit Controlled Loop we know that in The while loop the condition is check before the execution of the program but if the condition is not true then it will not execute the statements so for this purpose we use the do while loop in this first it executes the statements and then it increments the value of a variable and then last it checks the condition So in this either the condition is true or not it Execute the statement at least one time.

 

For:

In This loop all the basic operations like initialization, condition checking and incrementing or decrementing all these are performed in only one line. This is similar to the while loop for performing its execution but only different in its syntax.

 

Subject:CS201 Introduction to programming 

Date:28-05-2013

total mcqs of 1MArks each: 20

Total short Subjective  Questions of 3Marks:2Total short subjective Questions

Q) Write the syntax for calling function string manipulation function which compare the first 5 character array "name" with string "asdf"?

Q))When a pointer isincremented then how many bytes will it move to change its address?

Q)Declare an integer array longroutes and pointer routrptr and assign the address of array longroutes to the pointer variable routeptr to the pointer?

Q)Find which is legal and illegal ?

Q) show the output of the following code:

main()

{char st[]="~This is -a sample string!";

char*pch;

pch=strtoklstr,",-s`";

while(pch!=Null)

coutPch;

pch=strtok(NULL,",-s~")

}

return 0;

}

CS201 Introduction to Programming

Today Midterm Paper (27-5-2013)

 

Total Questions :26

20 Marks: 20 MCQ’S

2 Marks: 2 questions

3Marks: 2 questions

5Marks: 2 questions

 

  1. There is a pointer “ptr”of type int then address of which type of variable the ptr will store in it?

Variable of type char

Variable of type int

Variable of type double

Variable of type short

 

  1. Overflow condition occur when we try to assign a value to a variable which is _______

Less than its max size

Greater than its max size

Equal to

With in its range

 

  1. Which one of following statement is equal to x%=5?

x=%x5                         x=x%5             x=%5               x%=x5

 

  1. < , <=, >, >= are called ________ operators.

Logical Arithmetic                     Relational                     Conditional

 

  1. Correct way to initialize a character array ‘course’ with string “programming” is:

Course[12]=”programming”;

Course[]={”programming”};

 Course[]=’programming’;

 Course=”programming”;

 

  1. In c/c++ null cahracter is represented as:

\n                     \0                     \t                      \r

 

  1. To access the address of the variable ________ operator is used.

*

->

&&

&

 

  1. Afunction is a block of statements(codes) that can be ________

Defined repeatedly

Used limit no. of times

Defined once and used(call) as many times as required

Used only once

 

  1. In a return type of a function is void then it means that it will_______

Return any type of data

Return no data

Return some specific type of data                                              Return just char data

 

 

  1. C language was evolved from ________ language.

BASIC

FORTRAN

C++

B and BCPL

 

  1. The information stored in computer memory is ________

Volatile

Non-volatile

Redundant

Permanent

 

  1. A record is group of related ____________

Data

File

Bytes

Fields

 

  1. When accessing a structure member, the identifier to the left of the dot operator is the name of _________

A structure member

A tag

A variable

A keyword structure

 

  1. Stuctures are __________ allocation.

Heap

Queue

Stack

Cache

 

  1. An object of __________ class be created for saving the current possition of any opened file before reading from the file.

Filepos

Streampos

Stream

File stream

 

SUBJECTIVE PART:

 

How the two dimensional array is related to the matrix .2 MARKS

Assuming that “num” is a 2D array of character than what does statement *num contains? 2MARKS

 

 

Write a program in which you prompt the user to take 10 values in array and then display them ,sort the array and then find the maximum and minimum number in them . 3 MARKS

 

 

 

 

Write the output of the following: 5 MARKS

 

#include <iostream. h>

Union mytypes_t

{

            char c;

            int i;

            Float f;

}

mytypes;

 

int main();

{

 

            mytypes.c=’H’;

            mytypes.i=’15’;

 

coutsize of (mytypes)endl;

 

            mytypes.i=’15’;

            mytypes.c=’H’;

 

coutsize of (mytypes)endl;

 

return0;

 

}

 

 

Explain the logic of each statement:  5 MARKS

     Streampos orig=aFile,tellp();

     aFile.seekp(0.ios::end);

RSS

Looking For Something? Search Below

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service