T4Tutorials .PK

VU Past Papers CS201-Midterm Solved MCQs and Short Questions

Q#1: A precise sequence of steps to solve a problem is called
(A) Statement
(B) Program
(C) Utility
(D) Routine
Answer: (B) Program


Q#2: The compiler of C language is written in
(A) Java Language
(B) UNIX
(C) FORTRAN Language
(D) C Language
Answer: (D) C Language


Q#3: Initialization of variable at the time of definition is
(A) Must
(B) Necessary
(C) Good Programming
(D) None of the given options
Answer: (C) Good Programming


Q#4: In if structure the block of statements is executed only
(A) When the condition is false
(B) When it contains arithmetic operators
(C) When it contains logical operators
(D) When the condition is true
Answer: (D) When the condition is true


Q#5: Which of the following function(s) is/are included in stdlib.h header file?
(A) double atof(const char *nptr)
(B) int atoi(const char *nptr)
(C) char *strcpy(char *s1, const char *s2)
(D) 1 and 2 only
Answer: (D) 1 and 2 only


Q#6: Dealing with structures and functions passing by reference is the most economical method
(A) True
(B) False
Answer: (A) True


Q#7: Pointer is a variable which stores
(A) Data
(B) Memory Address
(C) Data Type
(D) Values
Answer: (B) Memory Address


Q#8: Preprocessor program performs its function before ______ phase takes place
(A) Editing
(B) Linking
(C) Compiling
(D) Loading
Answer: (C) Compiling


Q#9: Which of the following cannot be a variable name?
(A) area
(B) _area
(C) 10area
(D) area2
Answer: (C) 10area


Q#10: Which looping process is best when the number of iterations is known?
(A) for
(B) while
(C) do-while
(D) all looping processes require that the iterations be known
Answer: (A) for


Q#11: 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
Answer: (C) null


Q#12: How many bytes are occupied by the array char str[] = "programming";
(A) 10
(B) 11
(C) 12
(D) 13
Answer: (C) 12 → 11 characters + 1 null


Q#13: The header file that defines rand() function
(A) conio.h
(B) stdlib.h
(C) stdio.h
(D) iostream.h
Answer: (B) stdlib.h


Q#14: Commenting the code
(A) Makes a program easy to understand for others
(B) Makes programs heavy
(C) Makes it difficult to compile
(D) All of the given options
Answer: (A) Makes a program easy to understand for others


Q#15: What’s wrong with for (int k = 2, k <=12, k++)?
(A) the increment should always be ++k
(B) the variable must always be the letter i when using a for loop
(C) there should be a semicolon at the end of the statement
(D) the commas should be semicolons
Answer: (D) the commas should be semicolons


Q#16: For which array the size should be one more than the number of elements?
(A) int
(B) double
(C) float
(D) char
Answer: (D) char → because of null terminator for strings

Q#17: Category of software for Compiler and Interpreter
Answer: System Software → Language Translators

Q#18: Result of x = 2 + 3 * 4 - 4 / 2
Step: 3*4=12, 4/2=2 → 2+12-2=12
Answer: 12

Q#7: Total elements in 3×2 array
Answer: 3×2 = 6

Q#8: const int *ptr → pointer to constant integer
Answer: ptr is a pointer to const int

Q#9: ptr2 - ptr1 where ptr2=&arr[4], ptr1=&arr[1] → 4-1 = 3
Answer: 3

Q#10: Correct syntax to assign array arr to pointer ptr
Answer: ptr = arr;

Q#11: C is a/an ______ language
Answer: Function oriented language

Q#12: File extension for executable
Answer: .exe

Q#13: Variables having name, type, size are like empty boxes
Answer: True

Q#14: For loop issue for(int k=2,k<=12,k++)
Answer: Commas should be semicolons

Q#15: Most efficient method for structures is to define globally
Answer: True

Q#16: Syntax of union is identical to
Answer: Structure

Q#17: Result of x = 27/4
Answer: 6 (integer division)

Q#20: What is compiler?
Answer: A program that translates high-level language code into machine code.

Q#21: Difference between while and for loop:

For loop: Used when the number of iterations is known; initialization, condition, increment in

Exit mobile version