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-Introduction to Programming Solved Exam Paper

Q#1: In C/C++ the #include is called,
(A) Header file
(B) Preprocessor Directive
(C) Statement
(D) Function
Answer: (B) Preprocessor Directive

Q#2: To access the element of two dimensional array we use,
(A) Single referencing
(B) Single dereferencing
(C) Double dereferencing
(D) Double referencing
Answer: (C) Double dereferencing

Q#3: Data size of the file is always ______ the actual size of the file.
(A) Greater than
(B) Equal to
(C) Less than or equal to
(D) None of the above
Answer: (C) Less than or equal to

Q#4: When an identifier is declared with keyword const then,
(A) Its value can be changed during execution
(B) Its value cannot be changed
(C) Its value can be changed with arithmetic operator
(D) Its value can be overwritten
Answer: (B) Its value cannot be changed

Q#5: In C/C++ if we define an array of size eight (8) i.e. int Arr[8]; then the last element will be stored at,
(A) Arr[0]
(B) Arr[8]
(C) Arr[7]
(D) Arr[-1]
Answer: (C) Arr[7]

Q#6: If it is required to copy an array to another array then,
(A) Both arrays must be of the same size and data type
(B) Both arrays may be of different size
(C) Both arrays may be of different data type
(D) Both arrays may be of different size and type
Answer: (A) Both arrays must be of the same size and data type

Q#7: In C/C++ all character strings are terminated with,
(A) Null character
(B) String
(C) Zero
(D) Full stop
Answer: (A) Null character

Q#8: If int occupies 4 bytes and double occupies 8 bytes, what will be the size of the structure?
(A) 2
(B) 4
(C) 8
(D) 12
Answer: (D) 12

Q#9: When a pointer is incremented, it jumps the number of memory addresses,
(A) According to data type
(B) 1 byte exactly
(C) 1 bit exactly
(D) A pointer cannot be incremented
Answer: (A) According to data type

Q#10: Do-while loop executes at least,
(A) Zero time
(B) One time
(C) Two times
(D) N times
Answer: (B) One time

Q#11: += , *= , /= etc are called,
(A) Assignment operators
(B) Logical operator
(C) Compound assignment operator
(D) Unary operator
Answer: (C) Compound assignment operator

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

Q#13: Which is the correct syntax to print multiple values using cout?
(A) cout << “Hello” + x + “\n”;
(B) cout << “H” << x << “\n”;
(C) cout << “H”, x, “\n”;
(D) cout << (“H” & x & “\n”);
Answer: (B) cout << “H” << x << “\n”;

Q#14: Compilers and interpreters belong to system software.
(A) True
(B) False
Answer: (A) True

Q#15: Editors are used to compile the code.
(A) True
(B) False
Answer: (B) False

Q#16: Variables having a name, type and size are like empty boxes.
(A) True
(B) False
Answer: (A) True

Q#17: What will be the result of rand() % 50 ?
(A) Random numbers between 0 and 49
(B) Random numbers between 1 and 50
(C) Random numbers between 0 and 50
(D) Random numbers between 1 and 49
Answer: (A) Random numbers between 0 and 49


Q#18: What is the ASCII code of null character and how is it represented?
Answer: ASCII code of null character is 0 and it is represented as ‘\0’.


Q#19: What is a Truth Table?
Answer: A truth table is a table used in logic to show all possible values of logical variables and the resulting value of a logical expression for each combination.


Q#20: How learning to design programs is like learning to play soccer?
Answer: Learning to design programs is similar to learning soccer because both require practice, understanding rules, and improving skills step by step. Just like soccer players practice regularly to improve performance, programmers must practice writing programs to become better.


Q#21: What is the purpose of the default statement in switch statement?
Answer: The default statement in a switch statement is executed when none of the case conditions match the value of the expression. It acts like an else part of the switch structure.


Q#22: Write a program that converts hours, minutes and seconds into total seconds using a user defined function ConvertInSeconds.

Answer:
A program takes hours, minutes and seconds from user.
The function ConvertInSeconds converts the time into seconds using the formula:

Total Seconds = (hours × 3600) + (minutes × 60) + seconds

The function returns the total seconds and the main program displays the result.

Contents Copyrights Reserved By T4Tutorials