0% found this document useful (0 votes)
12 views3 pages

CSC 1 Questions

The document covers fundamental concepts of programming, including the role of programming languages, object-oriented programming principles, data types, control flow, functions, and debugging techniques. Key topics include the definition of classes and objects, principles like encapsulation and inheritance, and the importance of loops and functions in code organization. It also addresses common errors and debugging strategies in programming.

Uploaded by

ciastek.elo.320
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

CSC 1 Questions

The document covers fundamental concepts of programming, including the role of programming languages, object-oriented programming principles, data types, control flow, functions, and debugging techniques. Key topics include the definition of classes and objects, principles like encapsulation and inheritance, and the importance of loops and functions in code organization. It also addresses common errors and debugging strategies in programming.

Uploaded by

ciastek.elo.320
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Programming Basics

1. What is the main role of programming languages?


a) To speed up computers
b) To communicate with computers
c) To create hardware designs
d) To bypass logic flow

2. How do computers execute tasks?


a) By interpreting human emotions
b) By following the programmer’s exact instructions
c) By guessing the next logical step
d) By automatically fixing errors

Object-Oriented Programming (OOP)


3. What does a class represent in OOP?
a) A specific instance of an object
b) A blueprint for creating objects
c) A standalone piece of code
d) A function that operates globally

4. What is an object in OOP?


a) A syntax rule for programming
b) A group of unrelated variables
c) An instance of a class
d) A pre-defined data type

5. Which principle of OOP hides the internal state of an object?


a) Inheritance
b) Encapsulation
c) Abstraction
d) Polymorphism

6. What does abstraction aim to achieve?


a) Simplify code by exposing only relevant details
b) Create child classes from parent classes
c) Define attributes for a class
d) Enable objects to communicate directly

7. Which of the following is an example of inheritance in OOP?


a) A function returning a value
b) A child class reusing methods from a parent class
c) A loop iterating through objects
d) Accessing private attributes of a class

8. Polymorphism allows:
a) One method to behave differently in different classes
b) Multiple inheritance chains in one class
c) Defining private variables in a class
d) Combining two unrelated objects

Data Storage and Types


9. Which of the following is a primitive data type?
a) Object
b) Boolean
c) Array
d) Class

10. What does an array do?


a) Stores key-value pairs
b) Groups multiple variables of different types
c) Stores a collection of elements in fixed positions
d) Defines the structure of an object

Control Flow
11. Which logical operator ensures all conditions must be true?
a) OR (||)
b) NOT (!)
c) AND (&&)
d) EQUALS (=)

12. What is the main purpose of a loop in programming?


a) To skip irrelevant sections of code
b) To repeat a task until a condition is met
c) To replace conditional statements
d) To define an object instance

Functions
13. Functions are useful because:
a) They increase code repetition
b) They perform repetitive tasks in an organized way
c) They eliminate the need for variables
d) They restrict parameter inputs

14. Which of the following is NOT true about functions?


a) Functions must always return a value
b) Functions can have inputs called parameters
c) Functions can be reused in multiple parts of a program
d) Functions can be named to clarify their purpose
Debugging and Errors
15. Which of these is a syntax error?
a) Using the wrong logical operator
b) Forgetting a semicolon in JavaScript
c) Assigning an incorrect variable value
d) Writing an infinite loop

16. How can you debug a JavaScript program?


a) Ignore errors and restart the code
b) Use console.log statements or breakpoints
c) Write all code in one function
d) Use multiple variable scopes in one loop

You might also like