CS201 Mid term Solved Paper 2010 - 2

CS201 Midterm Paper 2010 - Introduction to Programming

Semester Spring 2010


CS201 - Introduction to Programming - Question No.: 1      ( M a r k s: 1 )
Compiler is a 
       System software
       Application Software
       Driver
       Editor


CS201 - Introduction to Programming - Question No.: 2    ( M a r k s: 1 )
If Num is an integer variable then Num++ means, 
       Add 1 two times with Num 
       Add 1 with Num 
       Add 2 with Num 
       Subtract 2 from Num


CS201 - Introduction to Programming - Question No.: 3    ( M a r k s: 1 )
For one byte there are _____ combinations of values that can be stored in computer. 
       26 
       27 
       28 
       24

CS201 - Introduction to Programming - Question No.: 4      ( M a r k s: 1 )
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

CS201 - Introduction to Programming - Question No.: 5      ( M a r k s: 1 ) 
 Default case in switch statement is, 
       Must 
       Optional 
       syntax error 
       Necessary

CS201 - Introduction to Programming - Question No.: 6      ( M a r k s: 1 )  
When break statement is encountered in switch statement, it 
       Stops the entire program 
       Stops the execution of current statement
        Exits from switch statement 
       None of the given options

CS201 - Introduction to Programming - Question No.: 7      ( M a r k s: 1 ) 
What will be the result of arithmetic expression 6+27/3*3?  
       33 
       45 
       9 
       30

CS201 - Introduction to Programming - Question No.: 8      ( M a r k s: 1 ) 
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[] ; 

CS201 - Introduction to Programming - Question No.: 9      ( M a r k s: 1 ) 
How many dimensions does n-dimensional array has? 
       n dimensions
        2n dimensions 
       (n+1) dimensions 
       (n-1) dimensions (Array starts from 0th element)

CS201 - Introduction to Programming - Question No.: 10      ( M a r k s: 1 )  
What will be the correct syntax to access the value of fourth element of an array using pointer ptr? 
       ptr[3] 
       (ptr+3) 
       *(ptr+3) 
       Both 1and 3

CS201 - Introduction to Programming - Question No.: 11      ( M a r k s: 1 ) 
 Which of the following values C++ use to represent true and false? 
       1 and 0 
       1 and -1 
       11 and 00 
       Any numerical value

CS201 - Introduction to Programming - Question No.: 12      ( M a r k s: 1 ) 
Declaring structures does not mean that memory is allocated.
       True
       False

CS201 - Introduction to Programming - Question No.: 13      ( M a r k s: 1 ) 
 For which array, the size of the array should be one more than the number of elements in an array?
       int 
       double 
       float  
       char


CS201 - Introduction to Programming - Question No.: 14      ( M a r k s: 1 ) 
If a variable is passed by value to a function and the function makes some changes to that variable then it
       does not affect the original variable 
       affects the original variable 
       causes syntax error 
       None of the given options

CS201 - Introduction to Programming - Question No.: 15      ( M a r k s: 1 ) 
 In C/C++ the #include is called,
       Header file 
       Preprocessor Directive 
       Statement 
       Function

CS201 - Introduction to Programming - Question No.: 16      ( M a r k s: 1 ) 
Loops are ------------------------ Structure.
       Decision 
       Repetition 
       Sequential 
       Hierarchical

CS201 - Introduction to Programming - Question No.: 17      ( M a r k s: 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?

CS201 - Introduction to Programming - Question No.: 18      ( M a r k s: 2 ) 
       Give one major use of pointer.

CS201 - Introduction to Programming - Question No.: 19      ( M a r k s: 2 )
Which standard library is included when your program reads from, or writes to, files?
Fstream.h

CS201 - Introduction to Programming - Question No.: 20      ( M a r k s: 3 )
Perform left shift operation on a binary number 0101 and write the result in binary and decimal.


CS201 - Introduction to Programming - Question No.: 21      ( M a r k s: 3 )
What is difference between variable and pointer?
  

CS201 - Introduction to Programming - Question No.: 22      ( M a r k s: 5 )
 Write a C/C++ program which defines an array of 10 elements.
This program should ask a number from the user and search this number in the array if the number exists in the array, it should display the location of the number otherwise display the message The number is not in the given array.
#include
#include

  1. void main (void)
  2. {
  3. clrscr();
  4. int array[10];
  5. int i = 0;
  6. int find=0;
  7. for (i=0;i<=9;i++)
  8. {
  9. printf("Enter %d Number: ",i+1);
  10. scanf("%d", &array[i]);
  11. }
  12. printf("Enter number to find from array: ");
  13. scanf("%d",&find);
  14. for (i=0;i<=9;i++)
  15. {
  16. if (find == array[i])
  17. {
  18. printf("\nThe Location for your search, in the array is %d",i);
  19. }

  1. }
  2. getch();
  3. }


CS201 - Introduction to Programming - Question No.: 23      ( M a r k s: 5 )
Write a C/C++ program which defines an array of 15 elements and fill the array with string "12players2teams".
This program should display that how many digits and alphabets the string "12players2teams" contains using Character handling functions.
Sample output of program:
Number of digits in string "12players2teams": 3
Number of alphabets in string "12players2teams": 12

Leave a Reply

Related Posts Plugin for WordPress, Blogger...