T4Tutorials .PK

VU Past Papers CS201-Solved Quiz Questions on Programming Basics

Q#1: We use ___ to open a file or stream for extraction
(A) in *
(B) out
(C) open
(D) read
Answer: (A) in

Q#2: Null character is represented by ___ in C++
(A) /0
(B) \0 *
(C) \n
(D) \t
Answer: (B) \0

Q#3: An object of ___ class can be created for saving the current position of any opened file before reading from the file
(A) Streampos *
(B) fstream
(C) ofstream
(D) ifstream
Answer: (A) Streampos

Q#4: ___ returns true if c is a digit or a letter and false otherwise
(A) isalpha
(B) isdigit
(C) isalnum *
(D) isspace
Answer: (C) isalnum(int c)

Q#5: We use ___ to open a file or stream for insertion
(A) in
(B) out *
(C) open
(D) write
Answer: (B) out

Q#6: Base address is the memory address of ___ element of an array
(A) 1st *
(B) 2nd
(C) 3rd
(D) 4th
Answer: (A) 1st

Q#7: ___ allow us to have a memory location and use it as int or char interchangeably
(A) structures
(B) unions *
(C) classes
(D) arrays
Answer: (B) union

Q#8: To read command-line arguments, the main() function itself must be given ___ arguments
(A) 0
(B) 1
(C) 2 *
(D) 3
Answer: (C) 2

Q#9: Individual characters in a string stored in an array can be accessed directly using array ___
(A) manipulation
(B) subscript *
(C) pointer
(D) reference
Answer: (B) subscript

Q#10: To manipulate n-dimensional array ___ nested loops are required
(A) n
(B) n-1 *
(C) n+1
(D) 1
Answer: (B) n-1

Q#11: A character is stored in the memory in
(A) string
(B) ASCII *
(C) Unicode
(D) integer
Answer: (B) ASCII

Q#12: What will be the size of following array? int arr[29];
(A) 29 *
(B) 30
(C) 18
(D) 32
Answer: (A) 29

Q#13: ___ are conventional names of the command line parameters of the main() function
(A) ‘argb’ and ‘argv’
(B) ‘argc’ and ‘argv’ *
(C) ‘argc’ and ‘argu’
Answer: (B) ‘argc’ and ‘argv’

Q#14: Suppose an integer type pointer contains a memory address 0x22f220. What will be the new memory address if we increment this pointer by one?
(A) 0x22f221
(B) 0x22f222
(C) 0x22f224 *
(D) 0x22f223
Answer: (C) 0x22f224

Q#15: Which header file must be included to use the functions tolower() and toupper()?
(A) iostream.h
(B) conio.h
(C) ctype.h *
(D) stdlib.h
Answer: (C) ctype.h

Q#16: Dereferencing operator is represented by
(A) * *
(B) +
(C) –
(D) none
Answer: (A) *

Q#17: In Analysis, we try to have a ___
(A) Determined inputs
(B) Break up of problem *
(C) Precise problem statement
(D) None of the given
Answer: (B) Break up of problem

Q#18: Pointers store the ___
(A) value of a variable
(B) memory address *
(C) characters
(D) none
Answer: (B) memory address

Q#19: The name of the array is a constant pointer which contains the memory address of the ___ of the array
(A) first element *
(B) last element
(C) second element
(D) none
Answer: (A) first element

Q#20: Whenever some number is added in an array name, it will jump as many ___ as the added number
(A) rows
(B) value *
(C) columns
(D) none
Answer: (B) value

Q#21: Returns true if c is a digit and false otherwise
(A) int isalpha(int c)
(B) int isalnum(int c)
(C) int isxdigit(int c)
(D) int isdigit(int c) *
Answer: (D) int isdigit(int c)

Q#22: At the ___, we try to break up the problem into functional units
(A) analysis phase *
(B) design phase
(C) implementation phase
(D) None of the given
Answer: (A) analysis phase

Q#23: The increment of a pointer depends on its ___
(A) variable
(B) value
(C) data type *
(D) none
Answer: (C) data type

Q#24: We must include the header file ___ to convert the value of one type into another type using built-in functions
(A) conio.h
(B) stdlib.h *
(C) string.h
(D) iostream.h
Answer: (B) stdlib.h

Q#25: To get the value stored at a memory address, we use the ___
(A) referencing operator
(B) dereferencing operator *
(C) simple operator
(D) None of the given
Answer: (B) dereferencing operator

Q#26: A character is stored in the memory in ___ byte
(A) integer
(B) string
(C) 1 *
(D) none
Answer: (C) 1

Q#27: char **argv can be read as ___
(A) pointer to char
(B) pointer to pointer *
(C) pointer to pointer to char
(D) None of the given
Answer: (B) pointer to pointer

Q#28: Returns true if c is a letter and false otherwise
(A) int isalpha(int c) *
(B) int isalnum(int c)
(C) int isxdigit(int c)
(D) int isdigit(int c)
Answer: (A) int isalpha(int c)

Q#29: Suppose we have int y[10]; To access the 4th element of the array we write
(A) y[4]
(B) y[3] *
(C) y[2]
(D) none
Answer: (B) y[3]

Exit mobile version