0% found this document useful (0 votes)
30 views

CS201 Midterm File by ZB

Uploaded by

eratech410
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

CS201 Midterm File by ZB

Uploaded by

eratech410
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

MCQS CS201 midterm preparation file ZB

In the name of God , Most


Gracious, Most merciful

CS201
MCQS Midterm preparation file ZB

ZB
MCQS

1. What is the primary function of an operating system?

a) Manage hardware

b) Manage software

c) Manage memory

d) All of the above

Answer: d) All of the above

2. Which of the following is a binary number?

a) 101101

b) 1000

c) 101010

d) All of the above

Answer: d) All of the above

3. What is the main function of the ALU in a computer?

a) Perform arithmetic and logical operations

b) Store data

c) Control input/output devices

d) Manage memory

Answer: a) Perform arithmetic and logical operations

4. What does CPU stand for?

a) Central Processing Unit

b) Central Performance Unit

c) Computer Performance Unit

d) Central Program Unit

Answer: a) Central Processing Unit


ZB
MCQS ZB
Midterm preparation file

5. Which of the following is a valid data type in C?

a) integer

b) float

c) char

d) All of the above

Answer: d) All of the above

6. In which memory is data stored permanently?

a) RAM

b) ROM

c) Cache memory

d) Register memory

Answer: b) ROM

7. Which language is considered the first programming language?

a) C

b) Java

c) Assembly

d) Fortran

Answer: d) Fortran

8. Which of the following is used to store large amounts of data?

a) RAM

b) Hard Drive

c) CPU

d) Cache

Answer: b) Hard Drive


MCQS ZB
Midterm preparation file

9. Which operator is used for logical AND in C?

a) &

ZB
b) &&

c) |

d) ||

Answer: b) &&

10. What does the term "compiling" mean?

a) Running a program

b) Translating high-level code into machine code

c) Debugging code

d) Writing source code

Answer: b) Translating high-level code into machine code

11. Which of the following is NOT a part of the CPU?

a) ALU

b) Register

c) Memory

d) Cache

Answer: c) Memory

12. Which of the following is a valid variable name in C?

a) 1variable

b) var_name

c) @var

d) variable name

Answer: b) var_name
MCQS Midterm preparation file

ZB
ZB
13. Which of these is an example of a high-level programming language?

a) Assembly

b) Machine language

c) Python

d) Binary code

Answer: c) Python

14. Which of the following is true about an array in C?

a) Arrays have fixed size

b) Arrays can grow dynamically

c) Arrays can store only integers

d) Arrays can store only strings

Answer: a) Arrays have fixed size

15. What is the function of the 'printf' statement in C?

a) Print output to the screen

b) Read input from the user

c) Store data in memory

d) None of the above

Answer: a) Print output to the screen

16. Which of the following is a valid C function declaration?

a) int main()

b) void main()

c) int main(void)

d) All of the above

Answer: d) All of the above


MCQS MIDTERM PREPARATION FILE ZB

17. Which of the following is the correct syntax for a for loop in C?

a) for (i=0; i<10; i++)

ZB
b) for (i=0; i<10; i+=2)

c) for (int i = 0; i < 10; i++)

d) All of the above

Answer: d) All of the above

18. Which of the following is a valid conditional operator in C?

a) ? :

b) & :

c) ->

d) ++

Answer: a) ? :

19. What is the purpose of a pointer in C?

a) To store the address of a variable

b) To store the value of a variable

c) To perform arithmetic operations

d) To loop through an array

Answer: a) To store the address of a variable

20. What is the function of the 'scanf' function in C?

a) Display output

b) Read input

c) Store output

d) None of the above

Answer: b) Read input


ZB
ZB
MCQS Midterm preparation file

21. What does the term "recursion" refer to in programming?

a) A process where a function calls itself

b) A type of loop

c) A way of storing variables

d) A method of sorting data

Answer: a) A process where a function calls itself

22. Which of the following is the correct way to declare a pointer in C?

a) int ptr;

b) int ptr;

c) int ptr;

d) ptr int;

*Answer: a) int ptr;

23. Which of the following is used for error handling in C?

a) exception handling

b) try-catch block

c) error() function

d) none of the above

Answer: d) none of the above

24. Which of the following is a type of loop in C?

a) while

b) do-while

c) for

d) All of the above

Answer: d) All of the above


ZB
MCQS ZB

Midterm preparation file


25. What is the default value of an uninitialized static variable in C?
a) 0
b) NULL
c) Undefined
d) Garbage value
Answer: a) 0

26. Which of the following is a valid comment in C?


a) // This is a comment
b) /* This is a comment */
c) # This is a comment
d) Both a and b
Answer: d) Both a and b

27. Which of the following is a keyword in C?


a) function
b) include
c) main
d) int
Answer: d) int

28. What is the correct format specifier for printing a float in C?


a) %d
b) %f
c) %s
d) %c
Answer: b) %f
MCQS ZB

ZB
Midterm preparation file
29. What does the 'break' statement do in C?

a) Exit from a loop or switch case

b) Continue to the next iteration of a loop

c) Pause the execution

d) None of the above

Answer: a) Exit from a loop or switch case

30. What is the purpose of the 'continue' statement in C?

a) Exit from a loop

b) Skip the current iteration and proceed with the next iteration

c) Jump to a specific location in the program

d) Stop the execution of a program

Answer: b) Skip the current iteration and proceed with the next iteration

31. Which of the following is true for a stack data structure?

a) It follows FIFO (First In, First Out) order

b) It follows LIFO (Last In, First Out) order

c) It can only store integers

d) It has no size limit

Answer: b) It follows LIFO (Last In, First Out) order

32. Which of the following is NOT a feature of object-oriented programming?

a) Encapsulation

b) Abstraction

c) Inheritance

d) Sequential processing

Answer: d) Sequential processing


ZB
MCQS

ZB
Midterm preparation file

33. What is the purpose of the 'malloc' function in C?


a) To allocate memory
b) To free allocated memory
c) To reallocate memory
d) To input data
Answer: a) To allocate memory

34. Which of the following is true about the 'free' function in C?


a) It releases dynamically allocated memory
b) It allocates memory
c) It stores data
d) None of the above
Answer: a) It releases dynamically allocated memory

35. What is the correct way to declare a function in C?


a) return_type function_name()
b) function_name() return_type
c) function_name return_type()
d) return_type function_name[]
Answer: a) return_type function_name()

36. Which of the following operators is used for pointer dereferencing in C?


a) &
b) *
c) ->
d) &&
**Answer: b) ***
ZB

ZB
MCQS
Midterm preparation file

37. Which of the following is the default access modifier for members of a class in C++?

a) private

b) public

c) protected

d) None of the above

Answer: a) private

38. Which of the following is NOT a valid access specifier in C++?

a) private

b) protected

c) public

d) confidential

Answer: d) confidential

39. Which of the following is true about inheritance in object-oriented programming?

a) It allows one class to inherit properties of another class

b) It allows a class to hide its implementation

c) It allows multiple classes to be combined into one class

d) It has no effect in object-oriented languages

Answer: a) It allows one class to inherit properties of another class

40. Which of the following is true about polymorphism in object-oriented programming?

a) It allows objects to take many forms

b) It allows data hiding

c) It allows data to be shared across classes

d) It restricts access to data

Answer: a) It allows objects to take many forms


ZB

ZB
MCQS
Midterm preparation file
41. Which of the following is an example of a constant in C?

a) #define PI 3.14

b) const int x = 5;

c) Both a and b

d) None of the above

Answer: c) Both a and b

42. Which of the following is true about constructors in C++?

a) A constructor is used to initialize an object

b) A constructor is called manually by the user

c) A constructor can only have one parameter

d) Constructors are only used in inheritance

Answer: a) A constructor is used to initialize an object

43. What is the purpose of the 'this' pointer in C++?

a) It points to the current object

b) It stores the memory address of a class

c) It refers to a function

d) It is used to access private members

Answer: a) It points to the current object

44. Which of the following is used for exception handling in C++?

a) try-catch block

b) exception keyword

c) assert function

d) None of the above

Answer: a) try-catch block


ZB
MCQS ZB
Midterm preparation file
45. Which of the following is a valid constructor definition in C++?

a) MyClass() {}

b) MyClass(void) {}

c) MyClass(int a) {}

d) All of the above

Answer: d) All of the above

46. Which of the following data types is used for storing decimal values in C?

a) int

b) float

c) char

d) bool

Answer: b) float

ZB +92 300 5427579


WhatsApp:
https://whatsapp.com/channel/0029VaODheTDp2Q8YVcoO
N2p
Second WhatsApp channel
channel on WhatsApp:
https://whatsapp.com/channel/0029VafvOcy90x2tPbUaX0
2I
YouTube:
https://youtu.be/-AMj4iNz0UE?si=hg29pJZ1kujzg57J

Phone no : +92 300 5427579


Phone no: +92 330 3869586
Email: [email protected]
ZB
MCQS Midterm preparation file

Passing criteria of this course

ZB
Passing Criteria for a Course:

The passing criteria is defined in such a way that it ensures the


student shall be consistent in his studies
throughout the semester.
Therefore, for passing a course/subject, student shall fulfill the
following:
a) Secure minimum 20% score in Formative Assessments/Mid
terms
b) Secure minimum 20% score in Final Term Examinations.
c) Secure at least 40% marks in aggregate while fulfilling the
above requirements
ZB

ZB
MCQS Midterm preparation file

Course Selection and Credit Hours

Q: How do I select courses when the course selection is open?


A: Follow these steps:
1. Check the credit hours allowed by your university (e.g., 21, 18, or 15
credit hours).
2. Each subject typically has 3 credit hours.
3. Divide the total allowed credit hours by 3 to determine how many
subjects you can select.
Examples:
21 credit hours = 7 su18 credit hours = 6 subjects
15 credit hours = 5 subjects
Remember, the university may allow different credit hours for each
student, so check your specific allowance.
By following these steps, you can make informed decisions during
course selection and manage your credit hours
effectively.

ZB

Advice
Hmaesha relax ho ke parha kryn panic mat hua kryn apky
parents ky bohat khawab hoty hn wo pura krny ki puri koshish
kea kryn kbi b ksi pe depend na kea kryn apko bs ak insan
success kr saqta ha or wo insan ap khud hn apky elawa koi nahe
ap bs koshish kryn Allah pak pe strong yakeen rakha kryn or
mehnat krke sb Allah ke hawaly kr dea kryn everything is
possible be brave be strong stay blessed
Hum insan hamesha moat se darty or bhagty hn or moat se
bachny ki koshish krty hn jabke moat ny ana hi ana ha hum
ZB
moat se nahe bach saqty humy jahanam se bachny ki koshish
krni chaheay hum jahanam se bach saqty hn
Insan ko 3 chezo se dar lagta ha Moat Risk/Dolat Ezat Shohrat
Fame

Moat
Humy pta hona chaheay Moat tab ani ha jab Allah
chahy us se pehly puri dunya bi ak tararf ho ke apko
marna chahy to apka kuch nahe beggar saqti

Risk/Dolat
Risk Dolat sb Allah pak ke hath m ha puri dunya ak
taraf b ho jay na apsy apka risk cheen saqti ha na de
saqti ha Ye sirf ALLAh pak ky hath m ha

Izat Zilat shohrat Fame


Izat Zilat Sirf Allah de saqty hn puri dunya mel ke b
apko zra brabr b demage nahe kr saqti Agr ALLAH
Apko izat dena chahay to puri dunya ak tararf ho ke
b apko 1% b nuksan nahe pohancha saqti
Phr Dar ks bat ka ???????????????
Be brave be strong Just put your trust To ALLAH
Hamesha Confident or himat se raho kbi ksi k samne
mat jhuko puri dunya mel k b apka kuch b nahe
beggar saqti
ZB
ZB
MY REQUEST FROM ALL OF YOU

ZB Request from All of you My family


Mjy ap sbki help or support ki zarort ha or wo ye k hum sb Mel
kr Allah ka Quran ki Urdu translation logo tak pohanchy or
Quran ko samjna asaaan kryn dosro k leay sb tak Allah ka Quran
pohanchy it's my compaign hum log 70+ age k ho jaty hn phr b
hmy namaz tak ki translation nahe pta hoti k hum Allah pak se

Kya Dua kr rhy hn so hum youngster's ko Mel kr puri takat or


energy ke sath Allah ka Quran spread krna ha
Hum puri Koshish kr rhy hn k hum sb Mel k Quran ki
translation or most important topics ko maximum share kry with
translation hmara maksad Quran ko spread krna ha be a part of
us
m apni pocket se ye sb kr rha ho Allah ka Quran spread krny k
leay apne or mene sbny Marna ha ak din to q na Allah k leay
Kuch kryn apni energies apni power ko bajay negative use krny k
Allah k leay invest kryn khud ko be a part of us
Agr m 23 ki age m apny sare sources use kr rha ho pocket se
heavy amounts give away kr rha ho Quran spread krny k leay to
ap just share to kr saqty hn itna e krdyn

Contact ZB +92 300 5427579

ZB
Agr ap mujsy contact na kr sky too b ap jo b hn jaha bi hn waha
Allah ka quran pheelay zada se zada with urdu translation jitni
himat ha utna share kryn
ZB
MY Family

ust Relax and focus! Exams are not difficult. Put in your
100% effort and trust in Allah.

AL-Quran

"And indeed, with hardship comes ease." (Quran 94:5)


Remember, I'm here to support you! Stay brave and strong!"

May Allah bless you

You might also like