CS201 Solved Short Notes 2017 | Virtual Study Solutions

Adsetra Ads

 

CS201 Solved Short Notes

Here we have CS201 Solved Short Notes Collection for mid term exam for spring 2017. Previously we shared CS 201 all past solved midterm papers 2015.

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

CS201 Solved Short Notes Collection

Question No: 1
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 floatArry[10] = {1.0,2.0,3.0,4.0};
Question No: 2

Write the general syntax for the declaration of pre-increment and post-increment member operator function.
Answer:
Classname operator ++(); —- pre increment
Classname operator ++(int) —- post increment
Question No: 3
Give the general syntax of class template.
Answer:
template
class myclass { —} ;

Recommended : CS201- midterm solved mcqs - Introduction to Programming

Question No: 4
What is a truth Table?
Answer:
There are some areas where the decision structures become very complicated. Sometimes, 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. It becomes complicated to determine what will be evaluated in what way. 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 gates. How we put these things together.
Question No: 5
What will be the output of following code, if user input a number 123?
int input ;
cin >> oct >> input;
cout hex input ;
Answer:
53 Rational: it will take 123 as octal and print it in hex form which is 53.
Question No: 6
What is principle of friendship in the context of functions and classes?
Answer:
Class can declare a friend function and someone from outside the class cannot declare itself friend of a class.
A friend function can access the private variables of class just like a member function

Question No: 7
How many arguments a Unary Operator take? Can we make a binary operator as unary operator?
Answer:
Unary operator takes only one argument like i++ or i— (Post increment or post decrement operators for integers) or ++i,–i (Pre increment or pre decrement operators for integers) ,we can not make Unary operator as binary or binary as Unary operator.
Question No: 8

Which arithmetic operators cannot have a floating point operand?

Answer:
Modulus operator:
This operator can only be used with integer operands ONLY

Question No: 9

What are manipulators? Give one example.

Answer:
The manipulators are like something that can be inserted into stream, effecting a change in the behavior. For example, if we have a floating point number, say pi (л), and have written it as float pi = 3.1415926 ; Now there is need of printing the value of pi up to two decimal places i.e. 3.14. This is a formatting functionality. For this, we have a manipulator that tells about width and number of decimal points of a number being printed.

Question No: 10

Write down piece of code that will declare a matrix of 3×3. And initialize all its locations with 0;

Answer:
int matrix [3] [3] ;

include

main () {
int matrix [3][3];
int inivalue = 0;

for (int a=0;a<3;a++)
{ for (int b = 0;b<3;b++)
{ matrix[a][b]= inivalue;
cout/p>
}
If You still have any question in mind let us know in comments.

إرسال تعليق

 

Top