Quiz
C# variables, loops and classes basics
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (114)
11. C-style languages are
- AC, C#, C++, Java
- BC, C#, C++
- CC#, C++
- DC, C#
- EC, C++
2Choose the incorrect statement for C style languages.
- Acurly brackets are used to group statements
- Bsemicolons are not used to denote the end of a statement
- Cvariables are assigned using an equals sign, but compared using two consecutive equals
sign - Da, b, c, d
- Esquare brackets are used with arrays
3Which aspects does variable have?
- Atype, size and memory address
- Bmemory address, type and value
- Ctype and value
- Dvalue, size and memory address
4What declaration of variables is the correct?
- Achar c, char s;
- Bdouble a, b;
- Cchar c;i;
- Dint b;c;
5Declaration of variable is not a statement of C# language, but ends with semicolon.
- Ayes
- Bno
6Declaration of variable is a statement of C# language.
- Ayes
- Bno
7Which rule is correct when naming variables?
- Aan identifier can consist of letters, number and reserved words
- Bthe first character must be letters, underscore only
- Creserved words can be used as variable names
- Dthe first character must be only letter
8 Choose the correct statement with initializing.
- Astring c="0";
- Bint i="0";
- Cchar c="0";
- Dint i='0';
9What method in C# is Console output?
- Aa) ReadLine
- Bb) WriteLine
1011. What method in C# is Console input?
- AWriteLine
- BReadLine
11The result in Console application of this code will be? int a=8, b=2, c=0; c=a+b;
Console.WriteLine(“{0}+{1}={2}”,b,a,c);- A2+8=10
- B8+2=10
- C10=2+8
- D10=8+2
12Choose the incorrect assignment? int i,j;
- Aa) i=j=1;
- Bb) i=10,j=10;
- Cc) i=(j=10);
- Dd) a, b, c
13 What will be the result? int i=5; int j=1; int x=(j--)+(--i);
- Ax=6;
- Bx=5;
- Cx=7;
- Dx=8;
14What will be the result? int x=10,i=0,j=2; x+=(i-j);
- A14
- B10
- C12
- D8
15 The “for” statement can be an infinite loop.
- Atrue
- Bfalse
1617. Choose the incorrect For statement?
- Aa) for(;;){}
- Bb) for( int x = 0, x<= 100; x++){}
- Cc) int x = 0;
for(; x<= 100; x++){} - Dd) a,b,c
1718. The statements bodies of the “for” and “while” operators might never be executed.
- Afalse
- Btrue
18The statements bodies of the “for” and “while” operators must be executed at least once.
- Atrue
- Bfalse
1920. The statements bodies of the “for” and “foreach” operators might never be executed.
- Atrue
- Bfalse
20The statements bodies of the “for” and “foreach” operators must be executed at least once.
- Atrue
- Bfalse
2122. In what statement the Statements body is always executed at least once?
- Aa) for, do while, while
- Bb) do while
- Cc) foreach, while
- Dd) do while, for
2223. C# classes contain:
- Aa) properties and functions
- Bb) data members(field, variables), properties and methods
- Cc) method, functions and constructors
- Dd) variables and methods
23The properties in C# classes are…
- Aprocedures and functions
- Bconstructors
- Cdata members(variables)
- Dmembers with get and set
24 C# procedure specifies with …
- Athis keyword
- Bvoid keyword
- Creturn data type
- Dstatic keyword
25An object is …
- Aa property of the class
- Ban instance of the class
- Ca method of the class
- Da data member of the class
26The classes are like new data types.
- ATrue
- BFalse
2728. Access modifiers are ...
- Avoid and return data types
- Bpublic and private
- Cdata types
- Dthis and static keywords
2829. A public method with the same name as the class with no return type is ...
- Aconstructor
- Bfunction
- Cprocedure
- Dproperty
29 Procedures and constructors can’t be passed any arguments.
- ATrue
- BFalse
30 Functions can’t be passed any arguments.
- ATrue
- BFalse
31 Functions can be passed any arguments.
- ATrue
- BFalse
32 Procedures can’t be passed any arguments.
- ATrue
- BFalse
33 Procedures can be passed any arguments.
- ATrue
- BFalse
34 Methods can be passed any arguments.
- ATrue
- BFalse
35Methods can’t be passed any arguments.
- ATrue
- BFalse
36The default constructor is a method with …
- Aa) any arguments
- Bb) no arguments
37In the static method must be absent “this” reference, as such method doesn’t work with any object.
- ATrue
- BFalse
38In the static method allowed immediate call only other instance methods.
- ATrue
- BFalse
39The “this” keyword can be used for...
- Amethods
- Bfunctions and procedures
- Cconstructors
- Da, b, c
4041. Choose the correct declaration of array.
- Aint[] a = int[10];
- Bint[] c = new int[10];
- Cint[] a = new [10];
- Da, b, c
41Choose the correct declaration of jugged array.
- Aint [][] j = new int[];
- Bint [][] j = new int[][5];
- Cint [][] j = int [5][5];
- Dint [][] j = new int[5][];
42Choose the correct declaration and initialization of array.
- Aint[] a = new int[5]{1,5,8,4,5};
- Bint[] a = {1,5,8,4,5};
- Ca,b
- Dthere is no correct answer
43 Choose the correct declaration of two-dimensional array.
- Aint[][] a = new int [2][5];
- Bint [] a = new int [2][5];
- Cint [,] a = new int[2,5];
- Dint[,] a = new int[2][5];
44 The last unit (element) index of array is…
- A0
- B10
- Clength
- Dlength-1
45How many elements does the next array include? Int[] a=new int[77];
- A76
- B77
- C78
46 How many elements does the next array include? Int[] a=new int[100];
- A99
- B100
- C101
47 C# function specifies with …
- Athis keyword
- Bvoid keyword
- Creturn data type
- Dstatic keyword
48The statements body of the “do while” operator might never be executed.
- ATrue
- BFalse
49The statements body of the “do while” operator must be executed at least once
- ATrue
- BFalse
50 Choose the correct assignment? int i,j;
- Ai,j=8;
- Bi=8,j=8;
- Ci=(j=8);
- Da,b,c;
51 Constructors can’t be passed any arguments.
- ATrue
- BFalse
52Constructors can be passed any arguments.
- ATrue
- BFalse
53 Default constructors can’t be passed any arguments.
- ATrue
- BFalse
54 Default constructors can be passed any arguments.
- ATrue
- BFalse
55How many elements does the next array include? int[] a=new int[99];
- A99
- B100
- C101
56
Choose the core principles of OOP- AEncapsulation and Inheritance
- BEncapsulation, Inheritance and Polymorphism
- Cencapsulation and polymorphism
- Dencapsulation, inheritance, polymorphism, aggregation and composition
57 Hiding an object’s internal implementation detail is…
- Aencapsulation
- Binheritance
- Cpolymorphism
- Dcomposition
58 Which concept promotes code reuse?
- Aencapsulation
- Binheritance
- Cpolymorphism
- Dcomposition
59 Which statement shows Encapsulation concept?
- Astring s = “Hello World!”;
- Bint a,b=0;
- Cb++;
- Dstring s = “hello”, bool i=s.Equals(“!”);
60 Closely related to the notion of encapsulating programming logic is the idea of…
- Aoverriding
- Bdata protection
- Coverloading
- Drealization
61 Which access modificator (s) related to the data protection?
- Apublic
- Bprotected
- Cprivate
- Dprivate and protected
62Members of a class that represent an object’s state should not be marked as
- Apublic
- Bprivate
- Cprotected
63Choose traditional technique to encapsulate class’s data.
- ADefine default constructor
- BDefine your own constructor
- CDefine a pair of public accessor(get) and mutator(set) methods
- DMark the data of class as public
64Choose a technique to encapsulate class’s data
- ADefine fields of class
- BDefine your own constructor
- CDefine a public properties
- DDefine a private properties
65 The “Black boxing programming” term is related to
- Ainheritance
- Bencapsulation
- Cobjects
- Dpolymorphism
6667. A “get” method …
- Areturns the current value of state data
- Breturns the default value of state data
- Callows to change the current value of state data
- Dallows to change the methods of class
67 A “set” method …
- Areturns the current value of state data
- Breturns the default value of state data
- Callows to change the current value of state data
- Dallows to change the methods of class
68 Is it possible to perform any internal logic necessary before making the value assignment in properties of class?
- Ayes
- Bno
6970. Which keyword is related to the "get" block of property?
- Avalue
- Breturn
- Cthis
- Dpublic
70 Which keyword is related to the "set" block of property?
- Avalue
- Breturn
- Cthis
- Dpublic
71Inheritance of OOP facilities ...
- Adata protection
- Bdata hiding
- Ccode reuse
72 Classical inheritance is …
- Aa model of “is-a” relationship
- Ba model of a “has-a” relationship
73 The parent class is
- Aa child class
- Ba derived class
- Ca base class
74 The extending classes are formally termed...
- Achild classes
- Bparent classes
- Cbase classes
75What role of parent class?
- Adefine all the common data and members for the classes that extend it
- Bdefine all the common methods for the classes that extend it
- Cdefine all the common data for the classes that extend it
- Ddefine all the common properties and functions for the classes that extend it
76 A child class inherits the constructor of a parent class.
- ATrue
- BFalse
77Which members can never be accessed from parent class?
- Apublic members
- Bprivate members
- Cprotected members
- Dprivate and protected
78 (?)Is it possible to build multiple inheritance for classes in C# language ?
- Ayes
- Bno
79 Which classes cannot have its child classes?
- Apublic classes
- Bsealed classes
- Cprivate classes
- Dderived classes
80 Which members of parent class cannot be accessed to other classes, but can be accessed to its child classes?
- Aall members
- Bpublic members
- Cprivate members
- Dprotected members
81 Another use of the "this" keyword is to design a class using a technique termed…
- Aconstructor definition
- Bconstructor creation
- Cconstructor chaining
- Dconstructor using
82The "base" keyword refers to …
- Athe parent class
- Bthe child class
- Cderived class
83 The process termed "method overriding" is …
- Aa way for base classes to define as own version of a method defined by its parent class
- Ba way for child classes to define its own version of a method defined by its derived class
- Ca way for parent classes to define its own version of a method defined by its child class
- Da way for child classes to define its own version of a method defined by its parent class
84 A virtual method of a parent class must be overridden for by each derived classes.
- ATrue
- BFalse
85A virtual method of a parent class must not be overridden for by each derived classes.
- ATrue
- BFalse
86 A virtual method of a parent class has its own implementation body block.
- ATrue
- BFalse
87 A virtual method of a parent class has not its own implementation body block.
- ATrue
- BFalse
88 An abstract method of a parent class has its own implementation body block.
- ATrue
- BFalse
89 An abstract method of a parent class has not its own implementation body block.
- ATrue
- BFalse
90 An abstract method of a parent class must be overridden for by each child class.
- ATrue
- BFalse
91
An abstract method of a parent class must not be overridden for by each child class.- ATrue
- BFalse
92Which feature is not related to an abstract class?
- Ait is impossible to create an instance(object) of an abstract class
- Ball abstract methods and properties of a basic class have not to be realized in a derived class
- Cthe abstract class may contain both abstract and common methods/properties
- Dall abstract methods and properties of a basic class have to be realized in a derived class
93 An interface is defined using...
- Athe capital letter “I” in the name
- Bthe interface keyword
- Cthe abstract keyword
- Dthe virtual keyword
94 An interface defines …
- Athe method signature
- Bthe virtual methods
- Cthe common methods
- Dthe abstract methods
95 Classes that implement an interface are contractually required to implement the interface signature definition and can’t alter it.
- ATrue
- BFalse
96
A class can support as many interfaces as necessary.- ATrue
- BFalse
97 A class can support only one interface.
- ATrue
- BFalse
98 A class cannot support as many interfaces as necessary.
- ATrue
- BFalse
99"Has-a" relationship is ...
- Atraditional form of code reuse in the world of OPP
- Banother form of code reuse in the world of OOP
- Ctraditional form of data protection in the world of OOP
- Danother form of data protection in the world of OOP
100"Has-a" relationship commonly includes ...
- Aencapsulation and composition terms
- Baggregation and polymorphism terms
- Cpolymorphism and composition terms
- Daggregation and composition terms
101 "Has-a" relationship must establish parent/child relationships.
- ATrue
- BFalse
102The "has-a" relationship allows one class to define a member variable of another class and expose its functionality (if required) to the object user indirectly.
- ATrue
- BFalse
103The .NET Framework allows to work with graphics using the ...
- ASystem.Drawing namespace
- BSystem.IO namespace
- CSystem.Windows.Form namespace
- DSystem.Data namespace
104Which class is used to draw lines, curves and shapes?
- AThe Brush class
- BThe Pencil class
- CThe Pen class
- DThe Region class
105 Which class is used to fill shapes?
- AThe Brush class
- BThe Pencil class
- CThe Pen class
- DThe Region class
106
Choose the correct code to specify the location of control?- Abutton1.Size = new Size(10,10);
- Bbutton1.Location = Point(10,10);
- Cbutton1.Location(10,10);
- Dbutton1.Location = new Point(10,10);
107
Choose the correct code to specify the size of control?- Abutton1.Size = new Size(10,10);
- Bbutton1.Location = Point(10,10);
- Cbutton1.Location(10,10);
- Dbutton1.Location = new Point(10,10);
108.Which properties of controls can be used to specify its location?
- ASize
- BLeft, Right, Top, Bottom
- CForeColor and BlackColor
- DLeft, Right
109Drawing begins with the ...
- ASystem.Drawing.Pen class
- BSystem.Drawing.Graphics class
- CSystem.Drawing.Brush class
- DSystem.Drawing.Image class
110To use Draw methods of the graphic object, we must provide an instance of the Pen class.
- ATrue
- BFalse
111To use Draw methods of the graphic object, we must provide an instance of the Brush class.
- ATrue
- BFalse
112Graphics.DrawLines, Graphisc.DrawPolygon, and Graphics.DrawRectangles accept arrays as parameters to allow us to create more complex shapes.
- ATrue
- BFalse
113To use Fill methods of the graphic object, we must provide an instance of the Brush class.
- ATrue
- BFalse
114To use Fill methods of the graphic object, we must provide an instance of the Pen class.
- ATrue
- BFalse
Information
- Description
- Quiz on Untitled, created by Анар Дарибаева on 03/12/2017.
- Author
- Анар Дарибаева
- Language
- English
- Views
- 0
- Tags
- Rating
- No ratings yet Rate this quiz