Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C# Programming Exam Questions and Answers, Exams of Computer Science

A set of multiple-choice questions and answers related to c# programming concepts. It covers topics such as threads, application domains, serialization, generics, data types, web server controls, database interaction, .net assemblies, namespaces, data sets, common language runtime (clr), events, and more. The questions are designed to test understanding of fundamental c# programming principles and practices.

Typology: Exams

2024/2025

Available from 01/27/2025

essay-writers
essay-writers 🇺🇸

3.8

(92)

1.9K documents

1 / 133

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PRN 211 EXAM 2025 (FULL EXAM) | COMPLETE EXAM
QUESTIONS AND CORRECT ANSWERS WITH
CORRECT ANSWERS | GRADED A+ | VERIFIED
ANSWERS | LATEST VERSION
Which sentence about foreground threads is correct?
A. Foreground threads have the ability to prevent the current application
from terminating.
B. You cannot create any foreground threads.
C. You can set a thread is foreground thread by using IsForeground
property.
D. Foreground threads are viewed by the CLR as expendable paths of
execution that can be ignored at any point in time. ---------CORRECT
ANSWER-----------------A
The method_____________of the Control class conceals the control from
the user.
A. Hide
B. Close
C. Dispose
D. Visible ---------CORRECT ANSWER-----------------A
Which sentence about Application Domain is correct?
A. The CLR is able to load and unload a formal process much quicker than
Application Domains.
B. The CLR does not create automatically any Application Domains at the
time the process launches.
C. A single process cannot host some Application Domains.
D. Application Domain is a logical partition within a process ---------
CORRECT ANSWER-----------------A
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download C# Programming Exam Questions and Answers and more Exams Computer Science in PDF only on Docsity!

PRN 2 11 EXAM 2025 (FULL EXAM) | COMPLETE EXAM

QUESTIONS AND CORRECT ANSWERS WITH

CORRECT ANSWERS | GRADED A+ | VERIFIED

ANSWERS | LATEST VERSION

Which sentence about foreground threads is correct? A. Foreground threads have the ability to prevent the current application from terminating. B. You cannot create any foreground threads. C. You can set a thread is foreground thread by using IsForeground property. D. Foreground threads are viewed by the CLR as expendable paths of execution that can be ignored at any point in time. ---------CORRECT ANSWER-----------------A The method_____________of the Control class conceals the control from the user. A. Hide B. Close C. Dispose D. Visible ---------CORRECT ANSWER-----------------A Which sentence about Application Domain is correct? A. The CLR is able to load and unload a formal process much quicker than Application Domains. B. The CLR does not create automatically any Application Domains at the time the process launches. C. A single process cannot host some Application Domains. D. Application Domain is a logical partition within a process --------- CORRECT ANSWER-----------------A

You are required to build an application that can serialize an object to a file. Then, this file can be transferred to another program written in Java and running in Linux operating system to be de-serialized. Which of the following classes is the best choice for the above task? A. BinaryFormatter B. SoapFormatter C. NetworkFormatter D. Formatter ---------CORRECT ANSWER-----------------B Which of the following can be defined as generic? A. Structures B. All of the others C. Methods. Classes. Interfaces D. Delegates ---------CORRECT ANSWER-----------------B What is output of this code? static void Main() { intnumberl = 3; intnumber2 = 2; float number3 = numberl / number2; Console.Wntel_ine(number3.ToString()); } A. 1. B. 1 C. compile error ---------CORRECT ANSWER-----------------B What are NOT Web Server controls? A. ASP.NET controls. B. HTML controls C. HTML with value of runat property is server. ---------CORRECT ANSWER-----------------B What is output of the following code?

What is CTS? A. CTS is a set of rulejHEBSSlt0 ensure that products of compilers will work properly in .NET environment. B. CTS is a formal specification that documents how types must be defined in order to be hosted by the CLR. C. CTS is physically represented by mscore.dll library. D. CTS is a language that sits above any particular platform-specific instruction set. ---------CORRECT ANSWER-----------------B The name of an assembly consists of 4 parts: *

  1. The short name. On Windows this is the name of the Portable Executable file without the extension
  2. The culture.
  3. The version.
  4. A/an me A. private key token B. public key token C. strong name D. None ofthe others ---------CORRECT ANSWER-----------------C What is output of the following code? class Program { delegate void Display(); static void Main() { Display d1 = new Display(DisplayHello); d1(); } static void DisplayHello() { Console.WriteLine("Hello"); }

A. Runtime error B. Hello C. Compile error at line: dl(): D. Compile error at line: delegate void Display(): ---------CORRECT ANSWER-----------------B Which event handler is fired when a new user logs on to your application? A. Session_Start() B. Application_Start() C. Application_End() D. Session_End() ---------CORRECT ANSWER-----------------A What is CLR? A. CLR is a language that sits above any particular platform-specific instruction set. B. CLR is a formal specification that documents how types must be defined in order to be hosted by the CLR. C. CLR is a set of rules provided to ensure that products of compilers will work properly in .NET environment. D. CLR is physically represented by mscore.dll library. ---------CORRECT ANSWER-----------------C Which sentence about HTML form is correct? A. An HTML form is located at header of web page. B. An HTML form is a named group of related Ul elements used to gather user input. C. An HTML form is entire display area shown by a given browser. D. An HTML form is placed outside of section. ---------CORRECT ANSWER-----------------B

A. RadioButton B. Label C. CheckBox D. Text Box ---------CORRECT ANSWER-----------------D Which sentence about components is correct? A. An example of components is OpenFileDialog. B. Most of components are not visible at runtime. C. Components are types that derive from the Control base class. D. Cannot configure components at design time. ---------CORRECT ANSWER-----------------A Does .NET Framework support to monitor the modification of a given external file? A. No B. Yes ---------CORRECT ANSWER-----------------B Which sentence is correct about C# language? A. C# language does not have pointer type. B. You do not have to de-allocate memory in C# language. C. C# language does not full support for interface-based programming techniques. D. C# language does not support to overload operators. ---------CORRECT ANSWER-----------------C We have to following sentences:

  1. VBScript and JavaScript are client-side script codes.
  2. JavaScript is a full-fledged OOP language. A. Sentence 1 is correct, sentence 2 is not correct. B. Sentence 1 is not correct, sentence 2 is not correct. C. Sentence 1 is not correct, sentence 2 is correct.

D. Sentence 1 is correct, sentence 2 is correct. ---------CORRECT ANSWER-----------------A What is output of the following code? class Human { public void Display() { Console.WriteLine("Human"); } } class Student : Human { public override void Display() { base.Display(); Console.WriteLine("Student"); } } class Program { static void Main() { Student s = new Student(); s.Display(); } } A. Human Student B. Human C. Student D. Compile error ---------CORRECT ANSWER-----------------D What is utility shows all of the types in your current project from an object- oriented perspective? A. Solution Explorer.

A. The type argument must be a non-nullable value type. The new constraint implies the class constraint and struct constraint B. None of the others C. The type argument must be a reference type, either nullable or non- nullable D. The type argument must have a public parameterless constructor. When used together with other constraint must be constraints, the new() specified last ---------CORRECT ANSWER-----------------D Which one in the below events is fired secondly during the page load? A. PreRender() B. Init() C. Unload() D. Load() ---------CORRECT ANSWER-----------------D Which keyword is used when you wish to explicitly reference the fields and members of the current object? A. abstract B. base C. this D. virtual ---------CORRECT ANSWER-----------------C Which event occurs when the form is closed? A. Closed B. Deleted C. Destroyed D. Disposed ---------CORRECT ANSWER-----------------A Which sentence about properties is correct? A. Properties can be static B. Properties have only set block. C. Properties must have set and get block.

D. Properties have only get block. ---------CORRECT ANSWER----------------

  • A Validity of a page can be checked using the _______ property. A. ValidateControl B. IsValidControl C. IsValid D. ControlToValidate ---------CORRECT ANSWER-----------------C Does DataTable class support a method that allows obtaining the data reader-like navigation scheme? A. No B. Yes ---------CORRECT ANSWER-----------------B Which sentence about Cookie is correct? A. Cookie is often realized as a text file on the web server. B. The exact location of cookie files does not dependent on which browser is using. C. Cookie is often realized as a text file on the user's machine. D. Cookie is used to maintain sensitive information about the current user. - --------CORRECT ANSWER-----------------C How many web.config files an ASP.NET application can have? A. An ASP.NET application don't have web.config file. B. Only 1. C. Greater than or equal 1. ---------CORRECT ANSWER-----------------C What is output of the following code? using System; class Program

Which sentence about BufferedStream is correct? A. BufferedStream provide a temporary storage for a stream of bytes that may be committed to storage at a later time B. BufferedStream is used to store textual information to a file. C. BufferedStream provides random access to streamed data stored in memory rather than a physical file. D. BufferedStream allows for random file access with data represented as a stream of bytes. ---------CORRECT ANSWER-----------------A Does "return 10 as long" compile? A. No, because there is no as operator in C# B. Yes C. No, because long is not a reference type D. No, because 10 cannot be cast to long ---------CORRECT ANSWER------ -----------C Unlike const however, read-only fields are NOT A. explicitly static B. explicitly internal C. implicitly internal D. implicity static ---------CORRECT ANSWER-----------------D Which Windows Forms control can be used to get characters from keyboard? A. Label B. ComboBox C. CheckBox D. ListBox ---------CORRECT ANSWER-----------------B

What is output of this code? DateTime dt = DateTìme.Parse("10/10/2009"); Console.WrỉteLine(dt.AddDays(22).ToString("dd/MM/yyyy"); A. 31/10/ B. 01/11/ C. Compile error D. 11/1/ E. 1/11/ F. 11/01/2009 ---------CORRECT ANSWER-----------------B Which property of form to get or set the button control that will be clicked when the user presses the Esc key? A. CancelButton B. EscButton C. AbortButton D. AcceptButton ---------CORRECT ANSWER-----------------A Which property do you use to set the title of a window? A. The SetText property B. The Text property C. The Caption property D. The Title property ---------CORRECT ANSWER-----------------B What is a "type" in the world of .NET? (Choose the most correct answer) A. Type is a generic term used to refer to a member from the set {class, structure, interface}. B. Type is a generic term used to refer to a member from the set {class, structure}. C. Type is a generic term used to refer to a member from the set {class, structure, interface, enumeration, delegation}. D. Type is a generic term used to refer to a member from the set {class, structure, interface, enumeration}. ---------CORRECT ANSWER----------------

  • C

using System; using System.Data.SqlClient; class Program { static void Main() { SqlCommand cmd = new SqlCommand(); Console.WriteLine(cmd.CommandText); } } A. There is no output B. Runtime error C. CommandText D. Compile error ---------CORRECT ANSWER-----------------A (ns)abstract class A { protected int x; public A() { x = 2; } public virtual void Print() { Console.Write(x*x); } class B : A { public B(){ x = 3; } public void Print() { Console.Write(x) } class Program { static void Main(string[ ] args)

A obj1 = new B(); obj.Print(); Console.WriteLine(); } } The ouput will be A. 9 B. 4 C. 0 D. 5 ---------CORRECT ANSWER-----------------A record A{ public int GetNumber() => 5; } record B : A{ public dynamic Calc(){ dynamic s = 0; for (int i = 1; i <= GetNumber(); i += 2) { s += i; } return s; } } class Program { static void Main(string[] args) { B obj = new B(); var s = obj.Calc(); Console.WriteLine(--s); } } The output will be: A. 7 B. 9 C. 8 D. 0 ---------CORRECT ANSWER-----------------C

A. 12

B. 21

C. 11

D. 22 ---------CORRECT ANSWER-----------------C

static void GetValue(ref int a, out int b, int c){ b = a + c; c++; c = a + b; } static void Main(string[ ] args){ int a = 3, b = 4, c = 5; GetValue(ref c, out b, a); Console.WriteLine($"a={a},b={b},c={c}"); } Which one of the following is the output of the above code? A. a=3,b=8,c= B. a=2,b=7,c= C. a=4,b=8,c= D. a=1,b=6,c=3 ---------CORRECT ANSWER-----------------A static int GetValue(out int a, out int b, int c){ a = ++c; b = a++; return c } static void Main(string[] args){ int a = 3, b = 4, c = 5; c = GetValue(out a. out b, c); Console.WriteLine($"a={a},b={b},c={c}"); } Which one of the following is the output of the above code? A. a=5,b=2,c= B. a=5,b=5,c= C. a=7,b=6,c=

D. a=7,b=8,c=8 ---------CORRECT ANSWER-----------------C static void GetValue(int a,ref int b,out int c){ c = 0; for (int i = a; i <=b; i++){ c += i; } } static void Main(string[] args){ int a = 1, b = 4, c=2; GetValue(a, ref bout c); Console.WriteLine($"a={a},b={b},c={c}"); } Which one of the following is the output of the above code? A. a=2,b=5,c= B. a=3,b=4,c= C. a=4,b=5,c= D. a=1,b=4,c=10 ---------CORRECT ANSWER-----------------D delegate void CallBack(string s); class Program{ public event CallBack evt; static void Main(){ Program p = new Program(); p.evt += delegate(string s){ Console.Write(s); }; p.evt += delegate{ Console.WriteLine("C#"); }; p.evt(".NET"); Console.ReadLine(); } } The output will be: A. .NETC#