Saturday 17 May 2014

CS201 Introduction To Programming Solved Quizzes

Posted at  02:05 - by Unknown 0

Which of the following you consider while making the framework of your table?
       ► How to order the rows and columns
       ► How to align entries in the columns
       ► Where to place special notes
       ► All of them

Question No: 2    ( Marks: 1 )    - Please choose one
 
In which of the following bars are replaced by drawings that represent the thing described?
       ► Bar graphs
       ► Line Graphs
       ► Pictographs
       ► Photographs
   
Question No: 3    ( Marks: 1 )    - Please choose one
 
Complete the question tag: They worked for Kaufman's,
       ► Did they?
       ► Haven't they?
       ► Didn't they?
       ► Had they?
   
Question No: 4    ( Marks: 1 )    - Please choose one
 
Biased language that might offend the audience is based on ---------------
       ► Cultural bias, gender bias
       ► Cultural bias, nationality bias
       ► Unity bias, nationality bias
       ► None of them
   
Question No: 5    ( Marks: 1 )    - Please choose one
 
What is meant by the term 'Connotative'?
       ► It refers to the literal meaning of words.
       ► It refers to the associations that are connected to a certain word.
       ► It refers to general meaning of words.
       ► It refers to cognitive meaning of words.
   
Question No: 6    ( Marks: 1 )    - Please choose one
 
How can we increase the audience’s ability to absorb and remember information from a purely practical standpoint?   
       ► Audience attention
       ► Presentation
       ► Speech
       ► The visual aids
   
Question No: 7   ( Marks: 1 )    - Please choose one
 
"I am currently studying veterinary medicine, and I am working part-time at an animal clinic." This statement in the introduction of the speech could best be described as:
       ► Gaining attention
       ► Revealing the topic
       ► Establishing credibility
       ► Bragging
   
Question No: 8    ( Marks: 1 )    - Please choose one
 
What is meant by task-facilitating roles?
       ► Suggesting decision-making procedures that will move the group towards the goal
       ► drawing out other members by showing verbal support
       ► offering to yield on a point in the interest of reaching mutually acceptable decision
 ► Drawing out other members by showing verbal and non verbal support, praise or
Agreement
   
Question No: 9    ( Marks: 1 )    - Please choose one
 
Choose the correct sentence.       
       ► You may not enter Mr. Harris office without his permission. 
       ► You may not enter Mr. Harrises office without his permission.
       ► You may not enter Mr. Harrises' office without his permission.
       ► You may not enter Mr. Harris's office without his permission.
   
Question No: 10    ( Marks: 1 )    - Please choose one
 
Choose the sentence with the correct punctuation.
       ► We ask, therefore; that you keep this matter confidential.
       ► We ask, therefore, that you keep this matter confidential. 
       ► We ask; therefore, that you keep this matter confidential.
       ► We ask: therefore, that you keep this matter confidential.
   
Question No: 11    ( Marks: 1 )  - Please choose one
 
Choose the sentence with the correct punctuation.
       ► The order was requested six weeks ago, therefore I expected the shipment to arrive by now.
       ► The order was requested six weeks ago, therefore, I expected the shipment to arrive by now.
       ► The order was requested six weeks ago: therefore, I expected the shipment to arrive by now.
       ► The order was requested six weeks ago; therefore, I expected the shipment to arrive by now. 

   
Question No: 12    ( Marks: 1 )   - Please choose one
 
Choose the sentence with the correct punctuation.
       ► The American flag has three colors: namely, red, white, and blue.
       ► The American flag has three colors, namely; red, white, and blue.
       ►  The American flag has three colors; namely, red, white, and blue. 
       ► The American flag has three colors namely, red, white, and blue.
   
Question No: 13    ( Marks: 1 )    - Please choose one
 
What is meant by intended reader?
       ► Simple reader
       ► Complex reader
       ► A member of a target audience
       ► Unplanned reader
   
Question No: 14    ( Marks: 1 )    - Please choose one
 
The act of considering or examining something in order to judge its value shows:
       ► Credibility
       ► Evaluation
       ► Conciseness
       ► All of them
   
Question No: 15    ( Marks: 1 )    - Please choose one
 
Which method is a bottom-up or generative approach to research?
       ► Pattern method
       ► Hypothesis method
       ► Inductive method
       ► Deductive method
   
Question No: 16    ( Marks: 1 )    - Please choose one
 
What are the best persuasive messages closely connected to?
       ► The indirect approach
       ► The positive aspects of your message
       ► The direct approach
       ► The desires and interests of the audience
   
Question No: 17    ( Marks: 1 )    - Please choose one
 
Choose the correct option.
A good business letter is simple and straightforward without being harsh or ----------.
       ► patriotic
       ► paternal
       ► patronizing
       ► panoramic
   
Question No: 18    ( Marks: 1 )    - Please choose one
 
Which type of Visual aid are three dimensions?
       ► Graphics
       ► Object
       ► Graph 
       ► Picture
   
Question No: 19    ( Marks: 1 )    - Please choose one
 
Choose the correct option.
Feasibility reports are used:
       ► To analyze problems and predict practical alternatives
       ► To control problems, sell products and services
       ► To monitor and control production, sales, shipping, etc.
       ► To solve problems and supply facts
   
Question No: 20    ( Marks: 1 )- Please choose one
 
What is the typical sequence of interviews?
       ► Screening stage and final stage.
       ► Screening stage, selection stage, and final stage.
       ► Selection stage and final stage.

       ► There is no typical sequence of interviews.

 Which one of these words is not a synonym for "business"?

       ► capital
       ► enterprise

       ► project

       ► venture
   
Question No: 2    ( Marks: 1 )    - Please choose one
 In which of the following bars are replaced by drawings that represent the thing described?

       ► Bar graphs

       ► Line Graphs

       ► Pictographs

       ► Photographs
   
Question No: 3    ( Marks: 1 )    - Please choose one
 Which of the following presents the main idea before the supporting data?
       ► Strategic plan
       ► Indirect plan
       ► Direct plan
       ► Business plan
   
Question No: 4    ( Marks: 1 )    - Please choose one
 Which question is used to ask about residential status?
       ► What's your address?
       ► Where are you from?
       ► Where do you belong to?
       ► Please sign here.
   
Question No: 5    ( Marks: 1 )    - Please choose one
 Which question asks for advice?
       ► What would you like to know?
       ► What should I do with my plastic bottles?
       ► I'm afraid I don't know where the entrance is.
       ► May I help you in any way?
   
Question No: 6    ( Marks: 1 )    - Please choose one
 Why style guides are widely used in organizations?

       ► To achieve a uniform document
       ► To achieve consistency of style
       ► To achieve good results
       ► Both i & ii
   
Question No: 7    ( Marks: 1 )    - Please choose one
 Claim letter is also called:



       ► Transmittal letter
       ► Credit refusing letter
       ► Adjustment letter
       ► Complaint letter
   
Question No: 8    ( Marks: 1 )    - Please choose one
 Which of the following can be defined as follows

“It is not merely politeness with mechanical insertion of ‘please’ and ‘thank you’, rather it is politeness that grows out of respect and concern for others.”
       ► Clarity
       ► Courtesy
       ► Consideration
       ► Credibility
   
Question No: 9    ( Marks: 1 )    - Please choose one
 Where we use proper tone from the beginning in a reasonable and understandable way?



       ► Neutral news message
       ►  Bad news message
       ► Good news message
       ►  Business message
   
Question No: 10    ( Marks: 1 )    - Please choose one
 Which of the following composition process is used in general and specific purpose while developing profile?


       ► Composing business message
       ► Defining objectives
       ► Bad news message
       ► Planning business message
   
Question No: 11    ( Marks: 1 )    - Please choose one
 Something that stands for or represents something else, especially an object representing an abstraction is called:


       ► Pagination
       ► Symbol
       ► Equation
       ► Acronyms
   
Question No: 12    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.

       
     

       ► Your award is richly-deserved.
       ►  Your award is richly deserved.
       ► Your award is richly, deserved.
       ► Your award is richly; deserved.
   
Question No: 13    ( Marks: 1 )    - Please choose one
 Which word in the following sentence should contain an apostrophe?

  Phillipa cannot go to her friends party because her parents have no cars.


       ► can’not
       ► parents’
       ► friend’s
       ► car’s
   
Question No: 14    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.

      
       

       ► The tomatoes whom grow in her garden are unlike those you buy in a store.
       ► The tomatoes who grow in her garden are unlike those you buy in a store.
       ►  The tomatoes that grow in her garden are unlike those you buy in a store.
       ► The tomatoes which grow in her garden are unlike those you buy in a store.
   
Question No: 15    ( Marks: 1 )    - Please choose one
 Identify the correct subjects and verbs. The subjects are in bold and the verbs are underlined.



       ► In the newspaper, an interesting article appeared.
       ► In the newspaper, an interesting article appeared.
       ► In the newspaper, an interesting article appeared.
       ► In the newspaper, an interesting article appeared.
   
Question No: 16    ( Marks: 1 )    - Please choose one
 Choose the sentence with the correct punctuation.

        
    

       ► I have been to San FranciscoCaliforniaRenoNevada, and SeattleWashington.
       ► I have been to San Francisco CaliforniaReno Nevada; and Seattle Washington.
       ► I have been to San FranciscoCaliforniaRenoNevada; and SeattleWashington.
       ► I have been to San Francisco CaliforniaReno Nevada, and Seattle Washington.
   
Question No: 17    ( Marks: 1 )    - Please choose one
 Choose the sentence with the correct punctuation.

        

       ► Clothes are often made from synthetic material; for instance, rayon.
       ► Clothes are often made from synthetic material, for instance, rayon. 
       ► Clothes are often made from synthetic material, for instance: rayon.
       ► Clothes are often made from synthetic material, for instance; rayon.
   
Question No: 18    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.

       

       ► The elections will be held on the first Tuesday, of November, 2008.
       ► The elections will be held, on the first Tuesday of November 2008.
       ► The elections will be held on the first Tuesday of November, 2008.
       ► The elections will be held on the first Tuesday of November 2008.
   
Question No: 19    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.

      
       ► I am asking if you would like to rollerblade together tomorrow?
       ► I am asking "if you would like to rollerblade together tomorrow"?
       ►  I am asking "if you would like to rollerblade together tomorrow."
       ► I am asking if you would like to rollerblade together tomorrow.
   
Question No: 20    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.

       
       ► Jan asked? "What did Joe mean when he said, 'I will see you later.'"
       ► Jan asked, "What did Joe mean when he said, 'I will see you later?'"
       ► Jan asked, "What did Joe mean when he said, 'I will see you later'?"
       ► Jan asked, "What did Joe mean when he said, 'I will see you later'"?
   
Question No: 21    ( Marks: 1 )    - Please choose one
 Which of the following report is often used when sending information to a reader outside the organization?

       ► Letter reports
       ► Business reports
       ► Formal reports
       ► Informal reports
   
Question No: 22    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.

       
      
      
       ► That is a problem who can't be solved without a calculator. 
       ► That is a problem that can't be solved without a calculator. 
       ► That is a problem whom can't be solved without a calculator.
       ► That is a problem which can't be solved without a calculator. 
   
Question No: 23    ( Marks: 1 )    - Please choose one
 Which of the following reports represent prefatory parts, text and supplementary parts?

       ► Formal reports
       ► Informal reports
       ► Analysis reports
       ► Progress reports
   
Question No: 24    ( Marks: 1 )    - Please choose one
 How many elements are found in general superstructure of reports?



       ► Three
       ► Two
       ► Six
       ► Five
   
Question No: 25    ( Marks: 1 )    - Please choose one
 While practicing your speech you should do all of the following except:
     



       ► Finish your speech without stopping to correct errors or to restart
       ► Practice in a singular setting
       ► Keep practice sessions brief
       ► Practice in various settings
   
Question No: 26    ( Marks: 1 )    - Please choose one
 Which of the following proposal section is related to researcher’s investigation?



       ► Justification of the study
       ► Research question
       ► Definition of terms
       ► Purpose of the study
   
Question No: 27    ( Marks: 1 )    - Please choose one
 How many elements are found in conventional superstructure for instructions?



       ► Three
       ► Four
       ► Five
       ► Two
   
Question No: 28    ( Marks: 1 )    - Please choose one
 Choose the correct sentence.
       ► You are my friend, however, I cannot afford, to lend you any more money.
       ► You are my friend, however; I cannot afford to lend you any more money.
       ► You are my friend: however I cannot afford to lend, you any more money.
       ► You are my friend; however, I cannot afford to lend you any more money.
   
Question No: 29    ( Marks: 1 )    - Please choose one
 How many categories of role playing are used in meetings?



       ► Three
       ► Two
       ► Four
       ► Five
   
Question No: 30    ( Marks: 1 )    - Please choose one
 How many elements are found in the conventional superstructure of a progress report?



       ► Three
       ► Four
       ► Five
       ► Six 
The result of 4%3 will be 
  2
 1.5
 1 1.33

 Question # 2 of 10 ( Start time: 12:31:34 PM )  Total Marks: 1
While developing a program; should we think about the user interface? 
 Yes No

Question # 3 of 10 ( Start time: 12:32:03 PM )  Total Marks: 1
Which of the following is the right syntax to declare a variable in C++? 
 VariableName  Datatype;
 DataType = VariableName;
 DataType  VariableName; (DataType)  VariableName; 
Question # 4 of 10 ( Start time: 12:32:30 PM )  Total Marks: 1
What will be the resultant value of this expression x =17%3 ?   
 1
 2

 3
 4
 Question # 5 of 10 ( Start time: 12:32:50 PM )  Total Marks: 1
What will be the result of the expression k = ++m; if initially k = 0 and m = 5? 
 0
 5
 6 4
 Question # 6 of 10 ( Start time: 12:33:08 PM )  Total Marks: 1
Function prototype is written, 
 Within main function
 After the return statement in main
 Before the return statement in main
 Before call of that function
Question # 7 of 10 ( Start time: 12:34:02 PM )  Total Marks: 1
Switch statement can be used in place of _________ statement. 
 break
 continue
 Multiple if goto 

Question # 8 of 10 ( Start time: 12:34:46 PM )  Total Marks: 1
In while loop the loop counter must be initialized, 
 With in the loop
 Before entering the loop At the end of the loop
 None of the given options 
Question # 9 of 10 ( Start time: 12:35:28 PM )  Total Marks: 1
What logical error exists in the following arithmetic expression? X = 50 / ( 2 % 2 ) + 9 
 ( ) parenthesis are not allowed in expressions
 Division by zero will occur in this expression Order of the expression is not according to rules
 We can not use % operator in expressions 
Question # 10 of 10 ( Start time: 12:36:06 PM )  Total Marks: 1
Loops are _______________ Structure. 
 Decision
 Sequential
 Repetition pg 560
 None of the given options

< and > both are _________ operators.Arithmetic
Relational
Logical PG 258Mathematical
Question # 2 of 10           Total Marks: 1
Find out the logical error in following lines of code. If (x = 10) cout << “x is 10”;10 should be enclosed in quotations
There is no semicolon at the end of if condition
Assignment operator should not be used for comparison
Variable x should not be inside parenthesis
Question # 3 of 10           Total Marks: 1
What will be the result of the expression j = i++; if initially j = 0 and i = 5?0
56
4
Question # 4 of 10           Total Marks: 1
Default mechanism of calling a function by passing it array is call by ________ and in case of passing variable is call by ________.Reference, Reference
Reference, value PG154, 119Value, Reference
Value, Value

Question # 5 of 10           Total Marks: 1
When the break statement is encountered in a loop’s body, it transfers the control ________from the current loop.Inside
OutsideTo break statement
To continue statement
Question # 6 of 10           Total Marks: 1
________statement is used to terminate the processing of a particular case and exit from switch structure.If
Goto
BreakContinue
Question # 7 of 10      Total Marks: 1 
When the if statement consists of more than one statement then enclosing these statement in braces is _________.  Compulsory Optional
 Not required
 Relevant

Question # 8 of 10    Total Marks: 1 
What will be the value of the variable output in the given piece of code? double output = 0; output = (2 + 2) * 4 + 2 / (4 – 2); 15
 17 12
 1

Question # 9 of 10   Total Marks: 1 
If we assign 2.06721 to an integer variable x, what will be the output if we print x using cout<< statement? 22.1
2.06
2.07
Question # 10 of 10      Total Marks: 1 
__________ will be used for clarity and to force the order of evaluation in an expression.  " "
 () PG32 ' '
 []


Q1- Determine the value of  m and n after the execution of code given below.
int m = 44;
int* p = &m;
int& r = m;
int n = (*p)++;
int* q = p - 1;
++*q; 
Assume that integers occupy 4 bytes and that m is stored in memory. (5 MARKS)
Q2- Write a program which defines two strings "Hello" and "Pakistan", merges both the strings using string manipulation function and displays on the screen. (5)
Q3- How the function strcpy() is different from the function strncpy() in terms of their working?Solution: 
strcpy: copy a string to another string variable
strncpy: copy n characters of a string to another string
 
Q4- Determine the output of the given code segment.

#include <iostream.h>

main()
{
    char *name[] = {"Ali", "Ahmad", "Riaz"};
    int x;
    int y; 
     
    x = sizeof(name);
    y = sizeof(*name);
   
    cout<<x<<endl<<y;

    return 0;

}



many categories of role playing are used in meetings?



       ► Three
       ► Two
       ► Four
       ► Five

suppose we have int y[10]; To access the 4th element of the array we write_______
y[4];
y[3];
y[2];
none of given
From the following; which one is the range of Random number generator function rand()?
0 – 32768
1 – 32768
0 – 32767
1 – 32767
From following; which one is the correct syntax of an array initialize: Array size is 10 and it is of double data type to value 0?
arr[10] = {0.0};
double arr[10]= 0.0;
double arr[10] = {0.0};
double arr[] = 0.0;
The string in the array is terminated by a_____
zero
nil
null
one


In C/C++; by default arguments are passed by_____to a function.
Reference
Value
Type
Data
1
char name [] = “Hello World” ; In the above statement, a memory of_______characters will be allocated
13
11
12
10
_______Keyword is used to return some value from a function.
break
return
continue
goto
Which of the function call is call by value for the following function prototype? float add(int);
add(&x);
add(x);
add(int x);
add(*x);
The increment of a pointer depends on its_________.
variable
value
data type
None of the given
The ASCHI code of null character is_________
000
010
111
110

Pointers are a special type of __________in which a memory address is storedvariables
Location
Characters
None of the given
just for copy paste



Transpose of a matrix means that when we interchange rows and columns_____________

the first row becomes the Last column
the first row becomes the first column
the Last row becomes the first column
the first column becomes the first row


Pointers store the ____________________
value of a variable
memory address
characters
None of the given

Which of the following function call is “call by reference” for the following function prototype? int add (int *);add(&x);
add(int x);
add(x);
add(*x);

The name of the array is a constant pointer which contains the memory address of the ____________of the array.first element
Last element
second element
None of the given

array name always contains the memory address of the ___________of the array

entire elements
last element
first element
None of the given


At the___________, we try to break up the problem into functional units

analysis phase
design phase
Implementation phase
None of the given

Q#2
__________ operator is used to pass the address of a variable in call by reference method.
Select correct option:
ANS: 
&


Question # 3 of 10 ( Start time: 09:46:29 PM ) Total Marks: 1
What will be the size of the array declared as int array[1000];
Select correct option:
ANS:
1000






Question # 4 of 10 ( Start time: 09:50:18 PM ) Total Marks: 1
Null character is used to indicate the __________ of string.
Select correct option:


ans:
end


Question # 5 of 10 ( Start time: 09:51:09 PM ) Total Marks: 1
X is an integer variable; what does X++ means,
Select correct option:

ans: 
Add one in x value


Question # 6 of 10 ( Start time: 09:52:36 PM ) Total Marks: 1
In C/C++; by default arguments are passed by _______ to a function.
Select correct option:
ans:
value




Question # 7 of 10 ( Start time: 09:53:26 PM ) Total Marks: 1
How many times the following do-while loop will execute? int k = 10; do { cout << "Statements" << endl; k -= 2; } while(k>0);
Select correct option:
ans: 5



Question # 8 of 10 ( Start time: 09:54:42 PM ) Total Marks: 1
_________ will be used for enclosing function statements into a block.
Select correct option:

ans:
( )



Question # 9 of 10 ( Start time: 09:55:48 PM ) Total Marks: 1
What is the output of the following code if the 3rd case is true switch (var) { case ‘a’: cout<<”apple”<<endl; case ‘b’: cout<<”banana”<<endl; case ‘m’: cout<<”mango”<<endl; default: cout<<”any fruit”<<endl; }
Select correct option:

ans: mango 





Question # 10 of 10 ( Start time: 09:57:44 PM ) Total Marks: 1
All elements of an array must be of_________ data type(s).
Select correct option:

ans:

same




Question No: 1 ( Marks: 1 ) - Please choose one
The function of cin is
► To display message
► To read data from keyboard
► 
To display output on the screen ► To send data to printer
Question No: 2 ( Marks: 1 ) - Please choose one
In C/C++ language the header file which is used to perform useful task and manipulation of character data is
► cplext.h
► ctype.h
► 
stdio.h ► delay.h
The functions toupper and islower are part of the character handling library <ctype.h>
Question No: 3 ( Marks: 1 ) - Please choose one
How many parameter(s) function getline() takes? ► 0
► ► 2
► 3


inFile.getLine(name, maxChar, stopChar); The first argument is a character array, the array should be large enough to hold the complete line. The second argument is the

maximum number of characters to be read. The third one is the character if we want to stop somewhere.
Question No: 4 ( Marks: 1 ) - Please choose one
Word processor is
► Operating system
► Application software
► 
Device driver
► Utility software
Question No: 5 ( Marks: 1 ) - Please choose one
For which values of the integer _value will the following code becomes an infinite loop?
int number=1;
while (true) {
cout << number;
if (number == 3) break;



number += integer_value; }
► any number other than 1 or 2 ► only 0
► only 1 ► only 2 Rational:
number += integer_value
above line decide the fate of loop so any thing other then zero leads to value of 3 which will quite the loop. Only zero is the value which keeps the loop infinite.

Question No: 6 ( Marks: 1 ) - Please choose one
Each pass through a loop is called a/an ► enumeration
► Iteration
► culmination ► pass through
Question No: 7 ( Marks: 1 ) - Please choose one
A continue statement causes execution to skip to ► the return 0; statement
► the first statement after the loop
► the statements following the continue statement ► the next iteration of the loop
continue statement is used, when at a certain stage, you don’t want to execute the remaining statements inside your loop and want to go to the start of the loop.
Question No: 8 ( Marks: 1 ) - Please choose one
What is the correct syntax to declare an array of size 10 of int data type? ► int [10] name ;
► name[10] int ; ► int name[10] ;
► 
int name[] ;
Question No: 9 ( Marks: 1 ) - Please choose one
Consider the following code segment. What will the following code segment display?
int main(){
int age[10] = {0};
cout << age ;
}
► Values of all elements of array ► Value of first element of array ► Starting address of array
► 
Address of last array element
Question No: 10 ( Marks: 1 ) - Please choose one
What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
► int arr[2][3] = {0,0} ;
► int arr[2][3] = {{0},{0}} ;
► 
int arr[2][3] = {0},{0} ;



► int arr[2][3] = {0} ;
Question No: 11 ( Marks: 1 ) - Please choose one
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
one int is 4 bytes so 4*3 = 12 bytes movement.
Question No: 12 ( Marks: 1 ) - Please choose one
If there are 2(n+1) elements in an array then what would be the number of iterations required to search a number using binary search algorithm?
► n elements
► (n+1) elements ► 2(n+1) elements ► 2(n+1) elements
Question No: 13 ( 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: 14 ( Marks: 1 ) - Please choose one
The ________ statement interrupts the flow of control.

► switch
► continue ► goto
► break
Question No: 15 ( Marks: 1 ) - Please choose one
Analysis is the -------------- step in designing a program ► Last
► Middle
► Post Design ► First
analysis will be always followed by design and then code.
Question No: 16 ( Marks: 1 ) - Please choose one
Paying attention to detail in designing a program is _________ ► Time consuming
► Redundant
► Necessary
► Somewhat Good
In programming, the details matter. This is a very important skill. A good programmer always analyzes the problem statement very carefully and in detail. You should pay attention to all the aspects of the problem.


Question No: 1      ( Marks: 1 ) - Please choose one
A precise sequence of steps to solve a problem is called ► Statement
► Program ► Utility ► Routine

Question No: 2      ( Marks: 1 ) - Please choose one
The Compiler of C language is written in ► Java Language
► UNIX
► FORTRON Language ► C Language

The C language is so powerful that the compiler of C and other various operating systems are written in C.
Question No: 3      ( Marks: 1 ) - Please choose one
Initialization of variable at the time of definition is, ► Must
► Necessary
► Good Programming
► None of the given options

Question No: 4      ( Marks: 1 ) - Please choose one
In if structure the block of statements is executed only, ► When the condition is false
► When it contain arithmetic operators ► When it contain logical operators ► When the condition is true





Question No: 5      ( Marks: 1 ) - Please choose one
Which of the following function(s) is/are included in stdlib.h header file? ► double atof(const char *nptr)
► int atoi(const char *nptr)
► char *strcpy ( char *s1, const char *s2) ► 1 and 2 only

Question No: 6      ( Marks: 1 ) - Please choose one
Dealing with structures and functions passing  by reference is the most economical method
► True
► False




Question No: 7      ( Marks: 1 ) - Please choose one
Pointer is a variable which store,
► Data
► Memory Address
► 
Data Type
► Values

Question No: 8      ( Marks: 1 ) - Please choose one
Preprocessor program perform its function before ______ phase takes place. ► Editing
► Linking
► Compiling ► Loading
The C preprocessor modifies a source code file before handing it over to the compiler. You're most likely used to using the preprocessor to include files directly into other files,
Question No: 9      ( Marks: 1 ) - Please choose one
Which of the following can not be a variable name? ► area
► _area
► 10area
► 
area2

Question No: 10      ( Marks: 1 ) - Please choose one
Which looping process is best, when the number of iterations is known? ► for
► while


► do-while
► all looping processes require that the iterations be known

Question No: 11      ( Marks: 1 ) - Please choose one
Which character is inserted at the end of string to indicate the end of string? ► new line
► tab
► null
► carriage return
null character inserted at the end of the string by C automatically





Question No: 12      ( Marks: 1 ) - Please choose one
How many bytes are occupied by declaring following array of characters?
char str[] = “programming”;
► 10
► 11 ► 12
► 
13
11 plus one for null char (11+1= 12)

Question No: 13      ( Marks: 1 ) - Please choose one
Which of the following header file defines the rand() function? ► iostream.h
► conio.h ► stdlib.h
► 
stdio.h
The function is rand() and is in the standard library. To access this function, we need to include <stdlib.h> library in our program. This function will return a random number. The number can be between 0 and 32767.
Question No: 14      ( Marks: 1 ) - Please choose one
Commenting the code _____________________
► Makes a program easy to understand for others.
► Make programs heavy, i.e. more space is needed for executable. ► Makes it difficult to compile
► All of the given options.

Question No: 15      ( Marks: 1 ) - Please choose one
What's wrong with this for loop?
for (int k = 2, k <=12, k++)


► the increment should always be ++k
► the variable must always be the letter i when using a for loop ► there should be a semicolon at the end of the statement ► the commas should be semicolons

Question No: 16      ( Marks: 1 ) - Please choose one
For which array, the size of the array should be one more than the number of elements in an array?
► int
► double ► float ► char

Question No: 17      ( Marks: 1 )
To Which category of the software “Compiler and Interpreter” belongs?
They belong to system software.
There are two type of system software

1.  Operating system
2.  Language translators.

These are part of language translators
Question No: 18      ( 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
Question No: 19      ( 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.
float tmp [10] = {1.0,2.0,3.0,4.0};
Question No: 20      ( Marks: 3 )
Write down the output of the following code?
int array[7], sum = 0;
for(int i=0;i<7;i++)
{
array[i] = i;
sum+= array[i];
}
cout<< “ Sum = “ <<sum;
answer: 21
Loop will run  times starts from zero and add values from 1 to 6 which is equal to 21



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<5; i++) {
A[i] = 2*A[i];
cout << A[i] << "  ";
}
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
Question No: 22      ( 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.”



















Question No: 1      ( Marks: 1 ) - Please choose one_______

There are mainly------------------- types of software

Two
►Three
►Four
►Five
Software is categorized into two main categories o System Software
o Application Software

Question No: 2      ( Marks: 1 ) - Please choose one____

In C/C++ the #include is called,



►Header file
Preprocessor Directive ►Statement
►Function


Question No: 3      ( Marks: 1 ) - Please choose one___________



&& is------------------ operator.

►An arithmetic


Logical
►Relational
►Unary
we use logical operators ( && and || ) for AND and OR respectively with relational operators.

Question No: 4      ( Marks: 1 ) - Please choose one_______
In flow chart, the symbol used for decision making is,


►Rectangle
►Circle
►Arrow
Diamond

Question No: 5      ( Marks: 1 ) - Please choose one______
The correct syntax of do-while loop is,
►(condition ) while; do { statements; };
►{ statements; } do-while ();
►while(condition); do { statements; };
do { statements; } while (condition);

Question No: 6      ( Marks: 1 ) - Please choose one___________


C++ views each file as a sequential stream of________________ . ►Bytes
►Bits
►0’s or 1’s
►Words

Question No: 7      ( Marks: 1 ) - Please choose one__________________

If the elements of an array are already sorted then the useful search algorithm is,

►Linear search
Binary search ►Quick search
►Random search
In binary search algorithm, the ‘divide and conquer’ strategy is  applied. This plies only to sorted arrays in ascending or descending order.

Question No: 8      ( Marks: 1 ) - Please choose one___________

The address operator (&) can be used with,
►Statement
►Expression Variable ►Constant

Question No: 9      ( Marks: 1 ) - Please choose one_______________
When a pointer is incremented, it actually jumps the number of memory addresses


According to data type ►1 byte exactly
►1 bit exactly
►A pointer variable can not be incremented
Question No: 10      ( Marks: 1 ) - Please choose one______________

Each pass through a loop is called a/an
►enumeration
iteration
►culmination
►pass through
Question No: 11      ( Marks: 1 ) - Please choose one_____________
Call by reference mechanism should be used in a program when there is
i. large amount of data to be passed
ii. small amount of data to be passed
iii. need to change the passed data
iv. no need to change the passed data
Choose the appropriate option for the above case.

► (i) and (ii) only
(i) and (iii) only ►(ii) and (iii) only ►(ii) and (iv) only

Question No: 12      ( Marks: 1 ) - Please choose one________


Which of the following is the starting index of an array in C++? 0
►1 ►-1
►any number

Question No: 13      ( Marks: 1 ) - Please choose one________
The return type of a function that do not return any value must be __________ ►int
void ►double
►float

Question No: 14      ( Marks: 1 ) - Please choose one_________

Which of the following is an extension of header file?


►.exe
►.txt 
.h 
►.c


What is the output of the following statement?
 int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
(a)   510
(b)   5
(c)   48
(d)  error
   
Question No: 2    ( Marks: 1 )    - Please choose one
 What does !(7) evaluate to in decimal where ! is a NOT operator?
(a)   7
(b)   8
(c)   9
(d)   10
   
Question No: 3    ( Marks: 1 )    - Please choose one
 The condition in while loop may contain logical expression but not relational expression.
(a)   True
(b)   False
   
Question No: 4    ( Marks: 1 )    - Please choose one
 Searching is easier when an array is already sorted
(a)   True
(b)   False

Question No: 5    ( Marks: 1 )    - Please choose one
 If an array has 100 elements, what is allowable range of subscripts?
(a)   0 - 99
(b)   1 - 99
(c)   0 - 100
(d)   1 - 100
   
Question No: 6    ( Marks: 1 )    - Please choose one
 What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3;
b = a++;

(a)        3, 4
(b)        4, 4
(c)        3, 3
(d)       4, 3
   
Question No: 7    ( Marks: 1 )    - Please choose one
 What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
(a)   int arr[2][3] = {0,0} ;
(b)  int arr[2][3] = {{0},{0}} ;
(c)   int arr[2][3] = {0},{0} ;
(d)   int arr[2][3] = {0} ;

Question No: 8    ( Marks: 1 )    - Please choose one
 Which of the following function returns the size of a string variable?

(a)   strlength()
(b)   stringlen()
(c)   strlen()
(d)   strLength()
   
Question No: 9    ( Marks: 1 )    - Please choose one
 What will be the range of numbers generated by function rand () % 9?
(a)   0 to 9
(b)   1 to 9
(c)   0 to 8
(d)   1 to 8
  
Question No: 11    ( Marks: 1 )    - Please choose one
 Computer can understand only machine language code.
(c)   True
(d)   False

Question No: 13    ( Marks: 1 )    - Please choose one
 What does 5 ^ 6 , evaluate to in decimal where ‘^’ is Exclusive OR operator?
(a)   True
(b)  False
Detail:-
It mean
5        =          0101
6        =          0110
5 ^ 6  =          0011
If both input is same then the output is 0 and if different then output is 1

Question No: 14    ( Marks: 1 )    - Please choose one
 If the file is not properly closed in the program, the program ____________.

(a)   Terminate normally
(b)   Indicate Runtime error
(c)   Indicate Compile time error
(d)   Crashes
   
Question No: 15    ( Marks: 1 )    - Please choose one
 Which of the following header file include string conversion functions?

(a)   string.h
(b)   stdlib.h
(c)   ctype.h

(d)   sconvert.h

Q1
When the if statement consists more than one statement then enclosing these statement in curly braces is,
(a) Not required
(b) Good programming
(c) Relevant
(d) Must

Q2
The while loop becomes infinite,
(a) When the condition is always false
(b) . When the condition is less than zero
(c) When the condition is always true
(d) When the condition contains a  logical operator

Q3
Which of the following function(s) is/are included in stdlib.h header file?

(a) double atof(const char *nptr)
(b) int atoi(const char *nptr)
(c) char *strcpy ( char *s1, const char *s2)
(d) 1 and 2 only

Q4
If we want to store a string “abc” in an array str then the size of this array must be at least, 
(a) 2
(b) 3
(c) 4
(d) 5

Q5
No executable code will be generated if error is found during translation of the program using interpreter.

(a) True
(b) False

Q6
Word processor is

(a) Operating system
(b) Application software
(c) Device driver
(d) Utility software

Q7
Which of the following is the correct syntax to print multiple values or variables in a single command using cout?
(a) cout << "Hello" + x + "\n";
(b) cout << "H" << x << "\n";
(c) cout << "H", x, "\n";
(d) cout << ("H" & x & "\n");

Q8
Which of the following is correct way to initialize a variable x of int type with value 10?

(a) int x ; x = 10 ;
(b) int x = 10 ;
(c) int x, x = 10;
(d) x = 10 ;
Q9
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
(a) parentheses ( )
(b) braces { }
(c) brackets [ ]
(d) arrows < >

Q10
Name of an array is a constant pointer.

(a) True
(b) False

Q11
How many bytes will the pointer intPtr of type int move in the following statement?
intPtr += 3 ;

(a) 3 bytes
(b) 6 bytes
(c) 12 bytes
(d) 24 bytes

Q12
What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3;
b = a++;

(a) 3, 4
(b) 4, 4
(c) 3, 3
(d) 4, 3

Q13
Loader loads the executable code from hard disk to main memory.
(a) True
(b) False

Q14
Which of the following is used with bit manipulation?

(a) Signed integer
(b) Un-signed integer
(c) Signed double
(d) Un-signed double

Q15
Which of the follwoing values C++ use to represent true and false?
(a) 1 and 0
(b) 1 and -1
(c) 11 and 00
(d) Any numerical value

Q16
The argument of the isdigit() function is ___________________
(a) a character,
(b) a C-string,
(c) a C++ string class variable
(d) None of the given options.

Compiler of C language is written in
       ► Java Language
       ► UNIX
       ► FORTRON Language
       C Language
Question No: 3      ( Marks: 1 ) - Please choose one
 
Initialization of variable at the time of definition is,

       ► Must
       ► Necessary
       Good Programming
       ► None of the given options
Question No: 4      ( Marks: 1 ) - Please choose one
 
In if structure the block of statements is executed only,
       ► When the condition is false
       ► When it contain arithmetic operators
       ► When it contain logical operators
       When the condition is true
Question No: 5      ( Marks: 1 ) - Please choose one
 
Which of the following function(s) is/are included in stdlib.h header file?
       ► double atof(const char *nptr)
       ► int atoi(const char *nptr)
       ► char *strcpy ( char *s1, const char *s2)
       ► 1 and 2 only

Question No: 6      ( Marks: 1 ) - Please choose one
 

Dealing with structures and functions passing  by reference is the most economical method
       True
       ► False
Question No: 7      ( Marks: 1 ) - Please choose one
 
Pointer is a variable which store,
       ► Data
      Memory Address
       ► Data Type
       ► Values
Question No: 8      ( Marks: 1 ) - Please choose one
 
Preprocessor program perform its function before ______ phase takes place.
       ► Editing
       ► Linking
       Compiling
       ► Loading
Question No: 9      ( Marks: 1 ) - Please choose one
 
Which of the following can not be a variable name?
       ► area
       ► _area
       10area
       ► area2
Question No: 10      ( Marks: 1 ) - Please choose one
 Which looping process is best, when the number of iterations is known?

       ► for
       ► while
       ► do-while
       all looping processes require that the iterations be known

Question No: 11      ( Marks: 1 ) - Please choose one
 
Which character is inserted at the end of string to indicate the end of string?
       ► new line
       ► tab
      ► null
       ► carriage return
Question No: 12      ( Marks: 1 ) - Please choose one
 
How many bytes are occupied by declaring following array of characters?
 char str[] = “programming”;


       ► 10
       ► 11
       ► 12
       ► 13
Question No: 13      ( Marks: 1 ) - Please choose one
 Which of the following header file defines the rand() function?
       ► iostream.h
       ► conio.h
       ► stdlib.h
       ► stdio.h
Question No: 14      ( Marks: 1 ) - Please choose one
 Commenting the code _____________________
       ► Makes a program easy to understand for others.
       ► Make programs heavy, i.e. more space is needed for executable.
       ► Makes it difficult to compile
       ► All of the given options.

Question No: 15      ( Marks: 1 ) - Please choose one
 
What's wrong with this for loop?
  for (int k = 2, k <=12, k++)
       ► the increment should always be ++k
       ► the variable must always be the letter i when using a for loop
       ► there should be a semicolon at the end of the statement
       the commas should be semicolons
Question No: 16      ( Marks: 1 ) - Please choose one
 For which array, the size of the array should be one more than the number of elements in an array?
       ► int
      ► double
        ► float 
      ► char

About the Author

Write admin description here..

0 comments:

Search Your Solution Here

Copyright © 2013 Virtual University Of Pakistan. by Bloggertheme9 Powered by Blogger.
WP Theme-junkie converted by Blogger template