C# - C Sharp: PRN212 - PT1


Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên

(nhấn nút 'Result' để biết kết quả)

Q1: What is the output of: int x = 10; if(x > 5) Console.Write("OK");?
NO
OK
10
Error

Q2: Which keyword is used to execute a block when a condition is false?
if
else
switch
case

Q3: How many times will this loop execute? for(int i=0;i<3;i++)
2
3
4
Infinite

Q4: Which loop checks the condition before executing the loop body?
do-while
while
foreach
loop

Q5: Which loop executes at least once even if the condition is false?
for
while
do-while
foreach

Q6: How do you declare an integer array of size 5 in C#?
int arr(5);
int arr[5];
int[] arr = new int[5];
array int arr = 5;

Q7: Array index in C# starts from:
-1
0
1
Depends on size

Q8: Which keyword is used to define a method in C#?
function
method
void
def

Q9: What is the return type of a method that returns nothing?
null
int
void
empty

Q10: Which OOP concept allows wrapping data and methods together?
Inheritance
Encapsulation
Polymorphism
Abstraction

Q11: Which keyword is used to inherit a class in C#?
implements
inherits
extends
:

Q12: Can a C# class inherit multiple classes?
Yes
No
Only abstract classes
Only interfaces

Q13: Which keyword is used to define an abstract class?
virtual
abstract
interface
static

Q14: Which member can an abstract class contain?
Only abstract methods
Only fields
Abstract and non-abstract methods
Only static methods

Q15: Which keyword is used to implement an interface?
implements
inherits
:
interface

Q16: What is a generic in C#?
A class with no methods
A type that works with any data type
A static class
An interface only

Q17: Which symbol is used to define a generic type?
[ ]
( )
< >
{ }

Q18: What is the correct way to declare a generic class?
class MyClass<T>
class MyClass(T)
class<T> MyClass
generic class MyClass

Q19: What is a delegate in C#?
A class that holds data
A method container
A reference type for methods
An interface

Q20: Which keyword is used to declare a delegate?
function
event
delegate
action

Q21: What is an event in C#?
A method
A variable
A notification mechanism
A class

Q22: Which keyword is used to declare an event?
notify
delegate
event
raise

Q23: Which LINQ method filters elements based on a condition?
Select()
Where()
OrderBy()
GroupBy()

Q24: Which LINQ method projects elements into a new form?
Where()
Select()
Join()
Any()

Q25: What does the LINQ method First() return?
All elements
The last element
The first element
A collection

Q26: Which statement correctly uses foreach?
foreach(int i in arr)
foreach i in arr
foreach(arr as i)
foreach(int i : arr)

Q27: Which access modifier allows access within the same assembly only?
public
private
internal
protected

Q28: Which keyword prevents a class from being inherited?
sealed
static
abstract
readonly

Q29: What is method overloading?
Same method name, different parameters
Same method name, same parameters
Different method names
Overriding methods

Q30: Which keyword is used to override a virtual method?
new
override
virtual
base

Q31: What is the default access modifier for class members in C#?
public
private
protected
internal

Q32: Which keyword allows a method to be overridden?
override
new
virtual
sealed

Q33: Which OOP concept means many forms?
Encapsulation
Inheritance
Polymorphism
Abstraction

Q34: Which class cannot be instantiated?
Sealed class
Abstract class
Static method
Normal class

Q35: Which interface member is allowed?
Fields
Constructors
Abstract methods
Destructors

Q36: What is boxing in C#?
Converting object to value type
Converting value type to object
Casting between classes
Using generics

Q37: What is unboxing?
Object to value type
Value type to object
Generic casting
Delegate call

Q38: Which collection works with key-value pairs?
List
Array
Dictionary
Queue

Q39: Which keyword is used to handle exceptions?
throw
catch
try
All of the above

Q40: Which block is always executed in exception handling?
try
catch
throw
finally

Q41: Which LINQ method checks if any element exists?
All()
Any()
Where()
Select()

Q42: Which LINQ method sorts data in ascending order?
OrderBy()
Sort()
GroupBy()
ThenBy()

Q43: What does IEnumerable represent?
A collection that can be iterated
A database table
A single object
A class only

Q44: Which keyword allows deferred execution in LINQ?
select
yield
return
await

Q45: Which statement correctly declares a lambda expression?
(x) => x * 2
x -> x * 2
function(x){return x*2;}
lambda x: x*2

Q46: What does the keyword static mean in C#?
Belongs to object
Belongs to class
Can be overridden
Can be inherited only

Q47: Which method is the entry point of a C# program?
Start()
Run()
Main()
Program()

Q48: Which keyword is used to create an object?
create
new
object
class

Q49: What is constructor used for?
Destroy object
Initialize object
Call methods
Override class

Q50: Which access modifier allows derived classes to access members?
private
public
protected
internal

Q51: Which keyword is used to free unmanaged resources?
delete
dispose
using
finalize

Q52: Which interface is used for resource cleanup?
ICloneable
IDisposable
IEnumerable
IComparable

Q53: Which keyword pauses execution until task completes?
wait
async
await
task

Q54: Which keyword marks a method as asynchronous?
await
thread
async
run

Q55: Which LINQ method groups elements?
Select()
GroupBy()
OrderBy()
Where()

Q56: Which LINQ method returns count of elements?
Any()
Sum()
Count()
Max()

Q57: What does var keyword do?
Declares dynamic variable
Infers type at compile time
Creates object
Declares constant

Q58: Which keyword is used to define a constant?
readonly
static
const
final

Q59: Which statement terminates a loop immediately?
continue
exit
break
return

Q60: Which keyword skips the current loop iteration?
break
pass
continue
skip

(Ghi chú: Phần câu hỏi Qi có màu Green thể hiện đáp án đúng)

(Ghi chú: Phần câu hỏi Qi có màu Green thể hiện đáp án đúng)
» Tiếp: Bài làm mẫu 1
« Trước: Quiz
Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên
Copied !!!