Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cs201 fall 2010 solve paper 1 December
#1
Question No: 1 ( Marks: 1 ) - Please choose one
[FONT=&quot]What is the output of the following statement? [/FONT]
[FONT=&quot] int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10); [/FONT]
(a) 510
(b) 5
© 48
(d) error

Question No: 2 ( Marks: 1 ) - Please choose one
[FONT=&quot]What does !(7) evaluate to in decimal where ! is a NOT operator?[/FONT]
(a) 7
(b) 8
© 9
(d) 10

Question No: 3 ( Marks: 1 ) - Please choose one
[FONT=&quot]The condition in while loop may contain logical expression but not relational expression.[/FONT]
(a) [FONT=&quot]True[/FONT]
(b) [FONT=&quot]False[/FONT]

Question No: 4 ( Marks: 1 ) - Please choose one
[FONT=&quot]Searching is easier when an array is already sorted[/FONT]
(a) [FONT=&quot]True[/FONT]
(b) [FONT=&quot]False[/FONT]

Question No: 5 ( Marks: 1 ) - Please choose one
[FONT=&quot]If an array has 100 elements, what is allowable range of subscripts?[/FONT]
(a) [FONT=&quot]0 - 99[/FONT]
(b) [FONT=&quot]1 - 99[/FONT]
© [FONT=&quot]0 - 100[/FONT]
(d) [FONT=&quot]1 - 100[/FONT]

Question No: 6 ( Marks: 1 ) - Please choose one
[FONT=&quot]What will be the value of ‘a’ and ‘b’ after executing the following statements?[/FONT]
[FONT=&quot]a = 3;[/FONT]
[FONT=&quot]b = a++;[/FONT]

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

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

Question No: 8 ( Marks: 1 ) - Please choose one
[FONT=&quot]Which of the following function[/FONT][FONT=&quot]returns the size of a string variable?[/FONT]

(a) [FONT=&quot]strlength()[/FONT]
(b) [FONT=&quot]stringlen()[/FONT]
© [FONT=&quot]strlen()[/FONT]
(d) [FONT=&quot]strLength()[/FONT]

Question No: 9 ( Marks: 1 ) - Please choose one
[FONT=&quot]What will be the range of numbers generated by function rand () % 9?[/FONT]
(a) [FONT=&quot]0 to 9[/FONT]
(b) [FONT=&quot]1 to 9[/FONT]
© [FONT=&quot]0 to 8[/FONT]
(d) [FONT=&quot]1 to 8[/FONT]

Question No: 11 ( Marks: 1 ) - Please choose one
[FONT=&quot]Computer can understand only machine language code.[/FONT]
© [FONT=&quot]True[/FONT]
(d) [FONT=&quot]False[/FONT]

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

Question No: 14 ( Marks: 1 ) - Please choose one
[FONT=&quot]If the file is not properly closed in the program, the program ____________.[/FONT]

(a) [FONT=&quot]Terminate normally[/FONT]
(b) [FONT=&quot]Indicate Runtime error[/FONT]
© [FONT=&quot]Indicate Compile time error[/FONT]
(d) [FONT=&quot]Crashes[/FONT]

Question No: 15 ( Marks: 1 ) - Please choose one
[FONT=&quot]Which of the following header file include string conversion functions?[/FONT]

(a) [FONT=&quot]string.h[/FONT]
(b) [FONT=&quot]stdlib.h[/FONT]
© [FONT=&quot]ctype.h[/FONT]
(d) [FONT=&quot]sconvert.h[/FONT]

Question No: 16 ( Marks: 1 ) - Please choose one
[FONT=&quot]In Program commenting the code liberally is[/FONT]
[FONT=&quot]Solution:- [/FONT]
[FONT=&quot]It need to be self-contained and understandable. Comments should be placed liberally. The comments should explain the logic, not the mechanics. Try to avoid fancy programming.[/FONT]
Question No: 17 ( Marks: 1 )
[FONT=&quot]Which header file must be included while handling files?[/FONT]
[FONT=&quot]Solution:- [/FONT]
Include <fstream.h>

Question No: 18 ( Marks: 1 )
[FONT=&quot]What is meant by C++ statement: [/FONT][FONT=&quot]const int *ptr = &x; [/FONT]
[FONT=&quot]Solution:-[/FONT]
ptr is a pointer to data of type const int type. And to assign the address of x to pointer ptr

Question No: 19 ( Marks: 2 )
[FONT=&quot]What is a truth Table?[/FONT]
[FONT=&quot]Solution:-[/FONT]
[FONT=&quot]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 gate. 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[/FONT].

Question No: 20 ( Marks: 3 )
(1) [FONT=&quot]An array [/FONT]day[FONT=&quot] is declared as: [/FONT][FONT=&quot]int day[] = {1, 2, 3, 4, 5, 6, 7};[/FONT]
[FONT=&quot] How many elements does array 'day' has? [/FONT]
[FONT=&quot]Solution:-[/FONT]
[FONT=&quot]7 elements[/FONT]
(2) [FONT=&quot]If the declaration is changed as: [/FONT][FONT=&quot]int day[7] = {1, 2, 3, 4, 5, 6, 7};[/FONT]
[FONT=&quot] How many elements does array 'day' has? [/FONT]

[FONT=&quot]Solution:-[/FONT]
[FONT=&quot]7 elements[/FONT]

Question No: 21 ( Marks: 5 )
[FONT=&quot]What are similarities and differences between Structures and Unions?[/FONT]
[FONT=&quot]In structures, we have different data members and all of these have their own memory space. In union, the memory location is same while the first data member is one name for that memory location. However, the 2[/FONT][FONT=&quot]nd [/FONT][FONT=&quot]data member is another name for the same location and so on. Consider the above union (i.e. intOrChar) that contains an integer and a character as data members. What will be the size of this union? The answer is the very simple. The union will be allocated the memory equal to that of the largest size data member. If the int occupies four bytes on our system and char occupies one byte, the union intOrChar will occupy four bytes[/FONT]

Question No: 22 ( Marks: 10 )
Write a void function( ); that takes integer numbers from the user and then displays the sum of odd and even numbers entered by the user. Your program should terminate if user enters a negative number
Solution:-

Code:
#include<iostream.h> #include<conio.h> void function(void); main() { function(); getche(); } void function(void) { int n[5]; for(int i=0; i<=5; i++) { cout <<"Enter Element = "; cin >>n[i]; } cout <<"\nODD Inputs are = \n"; for(int i=0; i<=5; i++) { if(n[i]%2==0) { cout <<n[i]<<endl; } } cout <<"\nEVEN Inputs are = \n"; for(int i=0; i<=5; i++) { if(n[i]%2==1) { cout <<n[i]<<endl; } } }
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  MCM301 MIDTERM solve paper 2011 Vuhelper 4 24,752 03-07-2015, 04:34 PM
Last Post: Xpert
  mgt602 midterm paper 3000 mcq's Xpert 5 11,330 05-30-2013, 02:16 PM
Last Post: Vuhelper
  SOLVED MIDTERM EXAMINATION spring 2010 CS610- Computer Network desireforheaven 8 4,000 05-16-2012, 03:26 PM
Last Post: sanam
  MID TERM PAST PAPER CS401 - Computer Architecture and Assembly SOLVE AND UNSOLVED usmanali126 2 6,361 04-13-2012, 03:27 PM
Last Post: Xpert
  Solved Paper MGT101 Fall 2009 Final Term viki 12 55,587 02-07-2012, 10:52 PM
Last Post: Xpert
  CS304 final term current paper spring Jily 2011 Vuhelper 1 3,487 02-04-2012, 10:34 PM
Last Post: roshi786
  Solved Paper of Final Term 2009 MTH101 Calculus And Analytical Geometry viki 8 11,965 02-04-2012, 12:47 AM
Last Post: Xpert
  eng 201 final term paper Business and Technical English Writing January 2012 Vuhelper 3 7,238 01-30-2012, 06:52 PM
Last Post: Xpert
  CS101- Introduction to Computing FINALTERM EXAMINATION mega paper 2012 Vuhelper 0 7,594 01-29-2012, 10:18 PM
Last Post: Vuhelper
  Solved Paper CS101 Introduction To Computing Fall 2009 viki 2 5,973 01-26-2012, 05:05 AM
Last Post: sluggishmentality

Forum Jump:


Users browsing this thread: 1 Guest(s)