Skip to main content

CS 201- Paper-02

Question No: 7      ( Marks: 1 ) - Please choose one
Keyword ‘array’ must be used to declare an array.
► True
► False
Question No: 8      ( Marks: 1 ) - Please choose one
What will be the value of x after executing following
switch(x){ case 1:
x += 1 ;
break ;
case 2:
x += 2 ; case 3:
x +=3 ;
break ; }
► 2
► 4
► 5
► 7
it wil be 7 as every case will add value to x
Question No: 9      ( Marks: 1 ) - Please choose one
When a function finishes its execution then,
► The control return to its Prototype
► The control returns to its definition
► Control returns to statement following function call
► The compiler stop execution of whole program
Question No: 10      ( Marks: 1 ) - Please choose one
What will be the output of following code segment?
main(){
int x = 5 ;
{
int x = 4 ;
cout << x << “,” ; } cout << x ; }       ► 4, 4 ► 4, 5 ► 5, 4 First call of x read local value which is 4 and next call is to x has value of 5 Question No: 11      ( Marks: 1 ) - Please choose one When an array element is passed to a function then this array element is pass function, By reference By data type By value By data   A single array element is like a variable, so when an array element is passed to a function, then by default it is passed by val   Question No: 12      ( Marks: 1 ) - Please choose one Which of the following operator is used to access the value of variable pointed to by a pointer? ►* operator ►-> operator
►&& operator
►& operator
Question No: 13      ( Marks: 1 ) - Please choose one
The       also belong to the System Software category.
►True
►False
Question No: 14      ( Marks: 1 ) - Please choose one
The argument of the isdigit() function is
►a character,
►a C-string,
►a C++ string class variable
►None of the given options.
Question No: 15      ( Marks: 1 ) - Please choose one
Declaring structures does not mean that memory is allocated.
►True
►False
Question No: 16      ( Marks: 1 ) - Please choose one
A union is a user-defined data type that contains only__________ from its list of members at
a time.
► One object
► Two objects
► ► Three objects
► None of the given options
Question No: 17      ( Marks: 1 )
What does 7 ^ 5 evaluate to in decimal and binary?
Question No: 18      ( Marks: 1 )
How can we evaluate a program?
Then the program should be evaluated by testing and checking
Question No: 19      ( Marks: 2 )
Which variable will be used in inner code block if we have the same names of variable at
outer code block and inner code block?
It will use inner block variable
Question No: 20      ( Marks: 3 )
What will happen if we omit braces within loop?
Loop will execute only single immediate line and complete the iteration. You can not run group of lines without use of curly braces.
Question No: 21      ( Marks: 5 )
Read the program below and write the output.
#include
main()
{
ofstream outfile;
char outfilename[] = “abc.txt”;
char outputtext[50] = “Welcome to VU”
outfile.open(outfilename, ios::out);
if(!outfile)
{
cout<<”Error Occured”;
exit(1);
}
outfile<<"Hello Buddies..." Program should not run as ofstream funcations are used, which are define in header file so program did not load that header file.
If we assume all libraries are loaded and referenced properly.
Then this program
Will create  file name abc.txt
If its already exit it will overwrite it and
Write the “Hello Buddies...Welcome to VU” in that file and close it.
Question No: 22      ( Marks: 10 )
Differentiate between C and c++
C++ was based on C and retains a great deal of the functionality. C++
does not retain complete source-level compatability with C.
There are a few  gotchas for C++ programmers trying to write C code, and
C programmers trying to compile with a C++ compiler.
Actually c is a procedural programming language which
cann't face the real world problem. It has some drawback
like a global data is shared by all function and if in a
large program it is find out difficult that which function
uses which data.
 
On the other hand c++ is an object oriented programming
language which eliminate some pitfall of conventional or
procedural programming language. It is a concept or
approach for designing a new software. It is nothing to do
with any programming language although a programming
language which support the oops concept to make it easier
to implement.
 
This is the main different between c and c++.

Comments

Popular posts from this blog

Drupal Answers Weekly Newsletter - Wednesday, December 31, 2014

Top new questions this week: Can I delete old hook_update_N functions? Suppose you have a custom module, and you have hook_update_N() implementations in your .install file. If you have old update functions, and all updates have run in all sites that the module is ... node-update hook-update-n   asked by AyeshK ...

[New post] 8th Class Result 2014 PEC Hafizabad Board

Muhammad Waqas posted: "PEC Hafizabad Board 8th Class Result 2014 expected date is 28th March, 2014 by PEC. Punjab Examination Commission (PEC) will announce 8th class result for Hafizabad Board soon and all the students of Hafizabad Board who are extremely waiting for the resul" New post on Jobs in Pakistan 8th Class Result 2014 PEC Hafizabad Board by Muhammad Waqas ...

[New post] 1st Year (11th Class) Result 2014 BISE Rawalpindi Board

Xaib Aslam posted: "BISERWP board Inter part 1 result expected on 10th October 2014 according our source. students of Rawalpindi board desperately waiting for 11th class result. 1st they upload the 12th class result and after some time they ready for showing the 1st year fin" New post on Jobs in Pakistan 1st Year (11th Class) Result 2014 BISE Rawalpindi Board by Xaib Aslam ...