Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS201- C++ Programming Important MCQs

Q#1: 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
Answer: (B) 5


Q#2: Searching is easier when an array is already sorted.
(A) True
(B) False
Answer: (A) True


Q#3: If an array has 100 elements, what is allowable range of subscripts?
(A) 0 โ€“ 99
(B) 1 โ€“ 99
(C) 0 โ€“ 100
(D) 1 โ€“ 100
Answer: (A) 0 โ€“ 99


Q#4: 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}
Answer: (D) int arr[2][3] = {0}


Q#5: Which function returns the size of a string variable?
(A) strlength()
(B) stringlen()
(C) strlen()
(D) strLength()
Answer: (C) strlen()


Q#6: Computer can understand only machine language code.
(A) True
(B) False
Answer: (A) True


Q#7: What does 5 ^ 6 evaluate to?
(A) 1
(B) 2
(C) 3
(D) 4
Answer: (C) 3


Q#8: Which header file includes string conversion functions?
(A) string.h
(B) stdlib.h
(C) ctype.h
(D) sconvert.h
Answer: (B) stdlib.h


Q#9: The statement const int *ptr = &x means:
(A) ptr is a constant pointer
(B) ptr points to constant integer
(C) ptr is pointer to constant int
(D) x is constant
Answer: (C) ptr is pointer to constant int


Q#10: The function of cin is:
(A) To display message
(B) To read data from keyboard
(C) To display output on screen
(D) To send data to printer
Answer: (B) To read data from keyboard


Q#11: Header file used for manipulation of character data is
(A) cplext.h
(B) ctype.h
(C) stdio.h
(D) delay.h
Answer: (B) ctype.h


Q#12: Each pass through a loop is called
(A) Enumeration
(B) Iteration
(C) Culmination
(D) Pass through
Answer: (B) Iteration


Q#13: Correct syntax to declare an array of 10 integers
(A) int [10] name
(B) name[10] int
(C) int name[10]
(D) array int[10]
Answer: (C) int name[10]


Q#14: Which operator accesses the value of a variable pointed by pointer?
(A) *
(B) ->
(C) &&
(D) &
Answer: (A) *


Q#15: Analysis is the ______ step in designing a program
(A) Last
(B) Middle
(C) Post design
(D) First
Answer: (D) First


Q#16: Which tool helps in tracing logical errors?
(A) Compiler
(B) Debugger
(C) Loader
(D) Editor
Answer: (B) Debugger


Q#17: The while loop becomes infinite when
(A) Condition is false
(B) Condition less than zero
(C) Condition always true
(D) Logical operator used
Answer: (C) Condition always true


Q#18: Which functions are included in stdlib.h?
(A) atof()
(B) atoi()
(C) strcpy()
(D) 1 and 2 only
Answer: (D) 1 and 2 only


Q#19: To store string “abc” in array, minimum size must be
(A) 2
(B) 3
(C) 4
(D) 5
Answer: (C) 4


Q#20: Word processor is
(A) Operating system
(B) Application software
(C) Device driver
(D) Utility software
Answer: (B) Application software


Q#21: Correct way to initialize variable x with 10
(A) int x; x = 10;
(B) int x = 10;
(C) int x, x = 10;
(D) x = 10;
Answer: (B) int x = 10;


Q#22: If more than one statement is in loop block, use
(A) ()
(B) {}
(C) []
(D) <>
Answer: (B) {}


Q#23: Name of an array is a constant pointer
(A) True
(B) False
Answer: (A) True


Q#24: Loader loads executable code from disk to memory
(A) True
(B) False
Answer: (A) True


Q#25: Bit manipulation mostly uses
(A) Signed integer
(B) Unsigned integer
(C) Signed double
(D) Unsigned double
Answer: (B) Unsigned integer


Q#26: C++ represents true and false as
(A) 1 and 0
(B) 1 and -1
(C) 11 and 00
(D) Any value
Answer: (A) 1 and 0


Q#27: Algorithm is
(A) Statement
(B) Program
(C) Utility
(D) Routine
Answer: (B) Program


Q#28: Compiler of C language is written in
(A) Java
(B) UNIX
(C) FORTRAN
(D) C language
Answer: (D) C language


Q#29: Variable name that is invalid
(A) area
(B) _area
(C) 10area
(D) area2
Answer: (C) 10area


Q#30: Best loop when number of iterations is known
(A) for
(B) while
(C) do-while
(D) all loops
Answer: (A) for


Q#31: String constant is enclosed in
(A) {}
(B) ()
(C) ”
(D) “”
Answer: (D) “”


Q#32: Decision symbol in flowchart
(A) Rectangle
(B) Circle
(C) Arrow
(D) Diamond
Answer: (D) Diamond


Q#33: Address operator is
(A) &&
(B) ++
(C) —
(D) &
Answer: (D) &


Q#34: Input output header file in C++
(A) maths.h
(B) string.h
(C) iostream.h
(D) ctype.h
Answer: (C) iostream.h


Q#35: Command line arguments are
(A) argc
(B) argv
(C) argd
(D) argc and argv
Answer: (D) argc and argv


Q#36: In 2D array
(A) First index row second column
(B) First column second row
(C) Both rows
(D) Both columns
Answer: (A) First index row second column


Q#37: Modulus operator works with
(A) float and int
(B) float and double
(C) int
(D) char
Answer: (C) int


Q#38: Result of 19 % 4
(A) 3
(B) 4
(C) 15
(D) 19
Answer: (A) 3


Q#39: End of string character
(A) New line
(B) Tab
(C) Null
(D) Carriage return
Answer: (C) Null


Q#40: Flowcharts explain program working in pictorial form
(A) True
(B) False
Answer: (A) True

Contents Copyrights Reserved By T4Tutorials