Tuesday, July 23, 2019

cs201 Solved Pass Paper

What is function of cout ?
 (a) To send data to printer
 (b) To read data from keyboard
(c) To display message
(d) To display output on the screen 

In Flow chart process is represented by
 (a) Rectangle 
(b) Arrow symbol
(c) Oval
(d) Circle

&& is -------------------- operator.
 (a) An arithmetic
 (b) Logical
 (c) Relational
l(d) Unary

An over Flow condition occurs when we try to assign a value to a variable which is,
 (a) Less than its maximum size
 (b) Greater than its maximum size
 (c) With in its range
(d) Equal to its size

Which of the following data type(s) can operate on modulus operator ‘%’?
 (a) float, int
 (b) float, double
 (c) int
 (d) char

Which of the following is the correct way to declare a variable x of integer type?
 (a) x int ;
(b) integer x ;
 (c) int x; 
(d) x integer

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

What will be the correct syntax to declare two-dimensional array of float data type?
 (a) float arr{2}{2} ;
 (b) float arr[2][2] ; 
(c) float arr[2,2] ;
(d) float[2][2] arr

In while loop the loop counter must be initialized,
 (a) With in the loop
 (b) Before entering the loop 
(c) At the end of the loop
 (d) None of the given options

There is a pointer variable named ptr of type int then address of which type of variable the ptr will store in it?
 (a) variable of type char
(b) variable of type short
 (c) variable of type int
 (d) variable of type double

 Suppose int multi[5][10]; when we are using **multi , it means,
 (a) Single dereferencing
(b) Single referencing
(c) Double referencing
 (d) Double dereferencing

The precedence of * is higher than dot operator (.)operator
(a) True 
(b) False

When a call to function statement is encountered,
 (a) The control transfers to its Prototype 
(b) The control transfers to its definition
 (c) Control returns to statement following function call
(d) The compiler stops execution of whole program

 A function must always return value.
(a) True 
(b) False




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

What does !(7) evaluate to in decimal where ! is a NOT operator?
 (a) 7
(b) 8
(c) 9 (
d) 10

The condition in while loop may contain logical expression but not relational expression.
 (a) True
(b) False

Searching is easier when an array is already sorted 
(a) True (
b) False

If an array has 100 elements, what is allowable range of subscripts?
 (a) 0 - 99
(b) 1 - 99
 (c) 0 - 100
 (d) 1 - 100

Which of the following function returns the size of a string variable? 
(a) strlength()
 (b) stringlen()
 (c) strlen() 
(d) strLength()

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

Computer can understand only machine language code.
 (c) True 
(d) False

Which of the following header file include string conversion functions? 
(a) string.h 
(b) stdlib.h
(c) ctype.h
(d) sconvert.h

The function of cin is 
(a) To display message
(b) To read data from keyboard 
(c) To display output on the screen
 (d) To send data to printer

How many parameter(s) function getline() takes?
 (a) 0
 (b) 1
 (c) 2 
(d) 3

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

Each pass through a loop is called a/an 
(a) enumeration
(b) Iteration 
(c) culmination
(d) pass through

A continue statement causes execution to skip to 
(a) the return 0; statement 
(b) the first statement after the loop
(c) the statements following the continue statement
(d) the next iteration of the loop

What is the correct syntax to declare an array of size 10 of int data type? 
(a) int [10] name ;
 (b) name[10] int ; 
(c) int name[10] ;

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} ;

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

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? 
(a) n elements
(b) n+1) elements
(c) 2(n+1) elements
 (d) 2 (n+1) elements

Which of the following operator is used to access the value of variable pointed to by a pointer?
 (a) * operator
 (b) -> operator
(c) && operator
 (d) & operator

The ________ statement interrupts the flow of control. 
(a) switch
 (b) continue
 (c) goto
(d) break

Analysis is the -------------- step in designing a program 
(a) Last
(b) Middle
 (c) Post Design
(d) First 

Paying attention to detail in designing a program is _________
(a) Time consuming
(b) Redundant
(c) Necessary
 (d) Somewhat Good

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

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

No executable code will be generated if error is found during translation of the program using interpreter. 
(a) True
 (b) False

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

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 ;

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 < >

Name of an array is a constant pointer.
 (a) True
 (b) False

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

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

 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.

A precise sequence of steps to solve a problem is called 
  Statement
  Program
Utility
Routine

The Compiler of C language is written in 
  Java Language
  UNIX
  FORTRON Language
  C Language 

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 

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

Dealing with structures and functions passing by reference is the most economical method
  True 
  False

Pointer is a variable which store,
  Data
  Memory Address
  Data Type
  Values

Which of the following can not be a variable name? 
area
  _area
  10area
  area2

Which of the following header file defines the rand() function?
  iostream.h
  conio.h
  stdlib.h 
  stdio.h
In C/C++ the string constant is enclosed 
(a) In curly braces
 (b) In small braces
 (c) In single quotes 
(d) In double quotes

In flow chart, the symbol used for decision making is,
 a) Rectangle
b) Circle
c) Arrow
d) Diamond

 The data type before a function name represents its, 
(a) Return Type
 (b) Function data
(c) Function arguments
 (d) Function name

The operator used to take the address of a variable is,
 (a) &&
 (b) ++
(c) –
 (d) & 

The header file which is used for input and output is
 (a) maths.h
(b) string.h
 (c) iostream.h 
(d) ctype.h

When we are using command line argument(s), the default argument in C/C++ is/are ____________ . a) argc
 b) argd
c) argv
d) argc and argv 

In C++, Integer calculation occurs in _____ bytes.
a) 1 byte
b) 2 bytes 
c) 4 bytes
d) 8 bytes

In the declaration of two dimensional array,
(a) First index represents row and second represents column
 (b) First index represents column and second represents row
 (c) Both indexes represent rows
 (d) Both indexes represent column

The address operator (&) can be used with,
a) Statement
 b) Expression
c) Variable 
d) Constant

Which character is inserted at the end of string to indicate the end of string?
 a) new line
 b) tab
c) null 
d) carriage return

Syntax of union is identical to ______
a) Structure 
b) Class
 c) Function
 d) None of the given options



Which programming tool is helpful in tracing the logical errors?
 Solution:Debugger tool is helpful in tracing the logical errors.

Why should goto statement be avoided in C/C++?
 When structured programming was started, it was urged not to use the goto statement. Though goto is there in C language but we will not use it in our programs. It will adopt the structured approach. All of our programs will consist of sequences, decisions and loop. Because loop provide best platform to manipulate the data.

What is a truth Table?
 Solution:- 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.

 What are similarities and differences between Structures and Unions?
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 2nd 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

What is a Linker?
 (3) Linker Most of the time our program is using different routines and functions that are located in different files, hence it needs the executable code of those routines/functions. Linker is a tool which performs this job, it checks our program and includes all those routines or functions which we are using in our program to make a standalone executable code and this process is called Linking




1 comment:

  1. Casino Site | Lucky Club Live UK
    In December 2018 we were presented with a brand new casino 카지노사이트luckclub site at Bet365, Our new UK online casino site is the first licensed UK online casino and

    ReplyDelete