CS201 - Introduction to Programming Final Term
Page 1 of 1 • Share
CS201 - Introduction to Programming Final Term
Question 1:
Identify each of the following as system software and application software.
LINUX, DISK CLEANUP, WORD PROCESSOR, WINDOWS, STUDENT INFORMATION (mark 5)
Q2:
Write the explanation of this program. See program from book pg no534. (mark5)
Q3: Write a program which defines three variables of type double which store three different values including decimal points, using set precision manipulators to print all these values with different numbers of digits after the decimal number.(5)
Q4 define static variable also explain life time of static variable? (3)
Q5 what do you know about run time error? (3)
Q6 what are limitation of the friendship between classes? (3)
Q7: read the code and explain the functionality of this program? See page 535 for cod (3)
Q8: write down the meanings of given below line of code, where m is an object of the class matrix. If (& m = this) (2)
Q9: write the general syntax for the definition of the user defined function? (2)
Q10: what is the source and destination of cin?(2)
Q11: write the general syntax of allocation memory dynamically to an array using new operator? (2)
[You must be registered and logged in to see this link.]
Identify each of the following as system software and application software.
LINUX, DISK CLEANUP, WORD PROCESSOR, WINDOWS, STUDENT INFORMATION (mark 5)
Q2:
Write the explanation of this program. See program from book pg no534. (mark5)
Q3: Write a program which defines three variables of type double which store three different values including decimal points, using set precision manipulators to print all these values with different numbers of digits after the decimal number.(5)
Q4 define static variable also explain life time of static variable? (3)
Q5 what do you know about run time error? (3)
Q6 what are limitation of the friendship between classes? (3)
Q7: read the code and explain the functionality of this program? See page 535 for cod (3)
Q8: write down the meanings of given below line of code, where m is an object of the class matrix. If (& m = this) (2)
Q9: write the general syntax for the definition of the user defined function? (2)
Q10: what is the source and destination of cin?(2)
Q11: write the general syntax of allocation memory dynamically to an array using new operator? (2)
[You must be registered and logged in to see this link.]
Re: CS201 - Introduction to Programming Final Term
[You must be registered and logged in to see this image.]
Asad- Deep Bench
- Posts : 563
Join date : 2011-02-11
Re: CS201 - Introduction to Programming Final Term
1.what is diffrent between pointer and variable?
2.What is difference between Unary and binary operators and how they can be overloaded?
3.how many types of templates?
4.What will be the output of following function if we call this function by passing int 5?
template T reciprocal(T x) {return (1/x); }
5. Identify the errors in the following member operator function and also correct them.
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
Answer:
The errors are in the arguments of the member operation function and also in the body of operator member function.
Correct function should be
math *operator(math *m);
math *operator (math *m)
{
math temp;
temp = m;
temp.number= number * number;
return temp.number;
2.What is difference between Unary and binary operators and how they can be overloaded?
3.how many types of templates?
4.What will be the output of following function if we call this function by passing int 5?
template T reciprocal(T x) {return (1/x); }
5. Identify the errors in the following member operator function and also correct them.
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
Answer:
The errors are in the arguments of the member operation function and also in the body of operator member function.
Correct function should be
math *operator(math *m);
math *operator (math *m)
{
math temp;
temp = m;
temp.number= number * number;
return temp.number;
Asad- Deep Bench
- Posts : 563
Join date : 2011-02-11
Re: CS201 - Introduction to Programming Final Term
Q: define buffer?explain its usage? 5 MARKS
Q: why binary search algorithm is efficient than linear search algorithm? 5 marks
Q: perator function ka syntex(3 marks)
Q:
post increment and pre increment k syntex btana thay(2 marks)
Q:what is language translator?(2 marks)
Q:
write somethiing something about testing in designing program? 3 MARKS
Q:Read the given below code and explain what task is being performed by this function 5 MARKS
Matrix :: Matrix ( int row , int col )
{
numRows = row ;
numCols = col ;
elements = new ( double * ) [ numRows ] ;
for ( int i = 0 ; i < numRows ; i ++ )
{
elements [ i ] = new double [ numCols ] ;
for ( int j = 0 ; j < numCols ; j ++ )
elements [ i ] [ j ] = 0.0 ;
}
}
[You must be registered and logged in to see this link.]
Hint : This function belong to a matrix class, having
Number of Rows = numRows
Number of Columns = numCols
Which one (copy constructor or assignment operator) will be
called in each of the following code segment?
1) Matrix m1 (m2);
2) Matrix m1, m2;
m1 = m2;
3) Matrix m1 = m2;
Q: why binary search algorithm is efficient than linear search algorithm? 5 marks
Q: perator function ka syntex(3 marks)
Q:
post increment and pre increment k syntex btana thay(2 marks)
Q:what is language translator?(2 marks)
Q:
write somethiing something about testing in designing program? 3 MARKS
Q:Read the given below code and explain what task is being performed by this function 5 MARKS
Matrix :: Matrix ( int row , int col )
{
numRows = row ;
numCols = col ;
elements = new ( double * ) [ numRows ] ;
for ( int i = 0 ; i < numRows ; i ++ )
{
elements [ i ] = new double [ numCols ] ;
for ( int j = 0 ; j < numCols ; j ++ )
elements [ i ] [ j ] = 0.0 ;
}
}
[You must be registered and logged in to see this link.]
Hint : This function belong to a matrix class, having
Number of Rows = numRows
Number of Columns = numCols
Which one (copy constructor or assignment operator) will be
called in each of the following code segment?
1) Matrix m1 (m2);
2) Matrix m1, m2;
m1 = m2;
3) Matrix m1 = m2;
Re: CS201 - Introduction to Programming Final Term
1.what is diffrent between pointer and variable?
Pointers
Pointer is a special type of variable that contains a memory address.
Variables are locations in memory for storing data.
2.What is difference between Unary and binary operators and how they can be overloaded?
Unary operators are the ones that require only one operator to work. Unary operators are applied to the left of the operand. For example, ^, &, ~ and !.
Binary operators require two operands on both sides of the operator. +, -, *, /, %, =, < and > are examples of binary operators.
3.how many types of templates?
There are two different types of templates in C++ language i.e.’ function templates and class templates.
4.What will be the output of following function if we call this function by passing int 5?
template T reciprocal(T x) {return (1/x); }
1/5
5. Identify the errors in the following member operator function and also correct them.
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
Answer:
The errors are in the arguments of the member operation function and also in the body of operator member function.
Correct function should be
math *operator(math *m);
math *operator (math *m)
{
math temp;
temp = m;
temp.number= number * number;
return temp.number;
Pointers
Pointer is a special type of variable that contains a memory address.
Variables are locations in memory for storing data.
2.What is difference between Unary and binary operators and how they can be overloaded?
Unary operators are the ones that require only one operator to work. Unary operators are applied to the left of the operand. For example, ^, &, ~ and !.
Binary operators require two operands on both sides of the operator. +, -, *, /, %, =, < and > are examples of binary operators.
3.how many types of templates?
There are two different types of templates in C++ language i.e.’ function templates and class templates.
4.What will be the output of following function if we call this function by passing int 5?
template T reciprocal(T x) {return (1/x); }
1/5
5. Identify the errors in the following member operator function and also correct them.
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
Answer:
The errors are in the arguments of the member operation function and also in the body of operator member function.
Correct function should be
math *operator(math *m);
math *operator (math *m)
{
math temp;
temp = m;
temp.number= number * number;
return temp.number;
Re: CS201 - Introduction to Programming Final Term
Cs201
40 Mcqs 12-2-2011 fall 2010 final tram paper of cs201
Q 1: How we can avoid a dangling reference? Marks[2]
Q 2: what is the source and destination of the cin stream? Marks [2]
Q 3: Give the general syntax of class template? Marks [2]
Q 4: Learning a program is important because it delelops____and____abilities.Marks [2]
Q 5; What is the main difference between structure and array? Marks [3]
Q 6: Identify all the given function as member function of input stream or output stream.
get,unget,put,getline,peek,putline. Marks [3]
Q 7: Is it possible to overload operators for primitive data types? Justify your answer. Marks [3]
Q 8: Read the given below code and explain what task is being performed by this function
Matrix :: Matrix ( int row , int col )
{
numRows = row ;
numCols = col ;
elements = new ( double * ) [ numRows ] ;
for ( int i = 0 ; i < numRows ; i ++ )
{
elements [ i ] = new double [ numCols ] ;
for ( int j = 0 ; j < numCols ; j ++ )
elements [ i ] [ j ] = 0.0 ;
}
}
Hint : This function belong to a matrix class, having
Number of Rows = numRows
Number of Columns = numCols. Marks [3]
Q 9: Write the procedure of data insertion in middle of the files by merge method, as practiced in older systems?
Q 10: Do you agree that in good programming practice the main() function is smaller than the class implemented. If your answer is No then argue and if Yes then support your answer briefly. Marks [5]
Q 11: Suppose we have the following class
Class Matrix
{
Private:
int Elements[3][3];
};
Write the operator function of stream extraction operator(>>) for this class. Marks [5]
Q 12: What is meant by user interface and class interface in c++? And what role a class interface can play in user interface. Marks [5]
40 Mcqs 12-2-2011 fall 2010 final tram paper of cs201
Q 1: How we can avoid a dangling reference? Marks[2]
Q 2: what is the source and destination of the cin stream? Marks [2]
Q 3: Give the general syntax of class template? Marks [2]
Q 4: Learning a program is important because it delelops____and____abilities.Marks [2]
Q 5; What is the main difference between structure and array? Marks [3]
Q 6: Identify all the given function as member function of input stream or output stream.
get,unget,put,getline,peek,putline. Marks [3]
Q 7: Is it possible to overload operators for primitive data types? Justify your answer. Marks [3]
Q 8: Read the given below code and explain what task is being performed by this function
Matrix :: Matrix ( int row , int col )
{
numRows = row ;
numCols = col ;
elements = new ( double * ) [ numRows ] ;
for ( int i = 0 ; i < numRows ; i ++ )
{
elements [ i ] = new double [ numCols ] ;
for ( int j = 0 ; j < numCols ; j ++ )
elements [ i ] [ j ] = 0.0 ;
}
}
Hint : This function belong to a matrix class, having
Number of Rows = numRows
Number of Columns = numCols. Marks [3]
Q 9: Write the procedure of data insertion in middle of the files by merge method, as practiced in older systems?
Q 10: Do you agree that in good programming practice the main() function is smaller than the class implemented. If your answer is No then argue and if Yes then support your answer briefly. Marks [5]
Q 11: Suppose we have the following class
Class Matrix
{
Private:
int Elements[3][3];
};
Write the operator function of stream extraction operator(>>) for this class. Marks [5]
Q 12: What is meant by user interface and class interface in c++? And what role a class interface can play in user interface. Marks [5]
Asad- Deep Bench
- Posts : 563
Join date : 2011-02-11
Re: CS201 - Introduction to Programming Final Term
[You must be registered and logged in to see this link.]
JAZAK ALLAH
JAZAK ALLAH
Asad- Deep Bench
- Posts : 563
Join date : 2011-02-11
Re: CS201 - Introduction to Programming Final Term
CS201_Introduction to Programming by ayesha
Thare were 52 Questions in my todays paper
40 MCQ’s
4 short Questions with marks 2
4 short Questions with marks 3
4 short Questions with marks 5
Total marks 80
Some Questions i remember that i'm sharing with you all
A template function must have at least ---------- generic data type
► Zero
► One
► Two
► Three
Which of the following statement is best regarding declaration of friend function?
► Friend function must be declared after public keyword.
► Friend function must be declared after private keyword.
► Friend function must be declared at the top within class definition.
► It can be declared anywhere in class as these are not affected by the public and
private keywords.
Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
► Class-name operator +() ;
► Class-name operator +(int) ;
► Class-name operator ++() ;
► Class-name operator ++(int) ;
Class is a user defined___________.
► data type
► memory referee
► value
► none of the given options.
How many bytes will the pointer intPtr of type int move in the following statement?
intPtr += 3 ;
► 3 bytes
► 6 bytes
► 12 bytes
► 24 bytes
Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
► new int(10) ;
► new int[10] ;
► int new(10) ;
► int new[10];
A Pointer is a special variable that contain
► Data values
► Memory Address
► Both data and values
► None of the given option
A structure is a collection of___________ under a single name.
Value
Variable
Data
None of the given
In C/C++; by default argument are passed by__________to a function.
Reference
Value
Type
Data
The code is written to __________ the program.
► implement
► design
► analysis
► none of the given options.
C++ views each file as a sequential stream of_______
Bytes
Bits
0’s or 1’s
Words
1. What is the keyword ‘this’ and what are the uses of ‘this’ pointer? Give an example.
2.What is difference between variable and pointer?
3.Consider the following code segment. What will be the output of the following code segment?
class class1{
public:
class class2{
public:
4. 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:
xxxxxx1000
xxxxxx1500
xxxxx20000
xxxxx30000
xxxxx60000
Pray for all
Thare were 52 Questions in my todays paper
40 MCQ’s
4 short Questions with marks 2
4 short Questions with marks 3
4 short Questions with marks 5
Total marks 80
Some Questions i remember that i'm sharing with you all
A template function must have at least ---------- generic data type
► Zero
► One
► Two
► Three
Which of the following statement is best regarding declaration of friend function?
► Friend function must be declared after public keyword.
► Friend function must be declared after private keyword.
► Friend function must be declared at the top within class definition.
► It can be declared anywhere in class as these are not affected by the public and
private keywords.
Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
► Class-name operator +() ;
► Class-name operator +(int) ;
► Class-name operator ++() ;
► Class-name operator ++(int) ;
Class is a user defined___________.
► data type
► memory referee
► value
► none of the given options.
How many bytes will the pointer intPtr of type int move in the following statement?
intPtr += 3 ;
► 3 bytes
► 6 bytes
► 12 bytes
► 24 bytes
Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
► new int(10) ;
► new int[10] ;
► int new(10) ;
► int new[10];
A Pointer is a special variable that contain
► Data values
► Memory Address
► Both data and values
► None of the given option
A structure is a collection of___________ under a single name.
Value
Variable
Data
None of the given
In C/C++; by default argument are passed by__________to a function.
Reference
Value
Type
Data
The code is written to __________ the program.
► implement
► design
► analysis
► none of the given options.
C++ views each file as a sequential stream of_______
Bytes
Bits
0’s or 1’s
Words
1. What is the keyword ‘this’ and what are the uses of ‘this’ pointer? Give an example.
2.What is difference between variable and pointer?
3.Consider the following code segment. What will be the output of the following code segment?
class class1{
public:
class class2{
public:
4. 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:
xxxxxx1000
xxxxxx1500
xxxxx20000
xxxxx30000
xxxxx60000
Pray for all
Abir- Monstars
-
Posts : 264
Join date : 2011-02-09
Age : 36
waqas- Monstars
-
Posts : 283
Join date : 2011-02-13
Age : 38
Re: CS201 - Introduction to Programming Final Term
thanks to all those who share there knowledge to others...!!!!!!!!!!!!
student- Monstars
-
Posts : 35
Join date : 2011-02-19
Age : 35
Location : Lahore
Similar topics
» CS201 - Introduction to Programming midterm papers
» CS201 Final Term Paper
» CS201 Final Term Paper
» CS508 - Modren Programming Language FINAL TERM PAPER
» SOC101 - Introduction to Socology FINAL TERM PAPER
» CS201 Final Term Paper
» CS201 Final Term Paper
» CS508 - Modren Programming Language FINAL TERM PAPER
» SOC101 - Introduction to Socology FINAL TERM PAPER
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Yesterday at 12:21 pm by ali001
» Hemangiom'App
Tue Nov 05, 2024 11:25 am by ali001
» MindfulMe - Mental Health App
Mon Nov 04, 2024 10:50 am by ali001
» Learn Candlestick Patterns
Tue Oct 15, 2024 5:51 am by ali001
» Woh Pagal Si Episode 52 to 62 - Top Pakistani Drama
Sat Sep 21, 2024 6:26 pm by Mir Emmad Ali Khan Domki
» Nearu - share your socials
Sat Sep 21, 2024 1:12 pm by ali001
» Nightclub Tycoon: Idle Empire
Thu Sep 19, 2024 9:16 pm by ali001
» Carnivore - Meat Diet Recipes
Wed Sep 18, 2024 2:37 pm by ali001
» Eid Milad un Nabi Mubarak 2024 (Rabiʻ I 14, 1446 AH)
Tue Sep 17, 2024 3:44 pm by Mir Emmad Ali Khan Domki