Test
C# basics: variables, loops, arrays and classes
Crea una cuenta gratis para terminar este test
Guarda tu progreso y consulta tu resultado final.
¿Ya tienes cuenta? Inicia sesión
Preguntas del test (50)
11. C-style languages are
- Aa) C, C#
- Bb) C, C++
- Cc) C, C#, C++
- Dd) C, C#, C++, Java
- Ee) C#, C++
22. Choose the incorrect statement for C style languages
- Aa) semicolons are not used to denote the end of a statement
- Bb) curly brackets are used to group statements
- Cc) variables are assigned using an equals sign, but compared using two consecutive equals
sign - Dd) square brackets are used with arrays
- Ee) a, b, c, d
33. Which aspects does variable have?
- Aa) type, size and memory address
- Bb) memory address, type and value
- Cc) type and value
- Dd) value, size and memory address
44. What declaration of variables is the correct?
4. What declaration of variables is the correct?- Aa) char c;i;
- Bb) int b;c;
- Cc) char c, char s;
- Dd) double a, b;
55. Declaration of variable is not a statement of C# language, but ends with semicolon.
- Aa) yes
- Bb) no
66. Declaration of variable is a statement of C# language.
- Aa) yes
- Bb) no
77. Which rule is correct when naming variables?
- Aa) the first character must be letters, underscore only
- Bb) an identifier can consist of letters, number and reserved words
- Cc) reserved words can be used as variable names
- Dd) the first character must be only letter
88. C# is case sensitive language
- Aa) yes
- Bb) no
- Cc) it depends on data type
99. Choose the correct statement with initializing.
- Aa) string c="0";
- Bb) int i="0";
- Cc) char c="0";
- Dd) int i='0';
1010. What method in C# is Console output?
- Aa) ReadLine
- Bb) WriteLine
1111. What method in C# is Console input?
- Aa) ReadLine
- Bb) WriteLine
1212. The 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);- Aa) 2+8=10
- Bb) 8+2=10
- Cc) 10=2+8
- Dd) 10=8+2
1313. Choose the incorrect assignment? int i,j;
- Aa) i=j=1;
- Bb) i=10,j=10;
- Cc) i=(j=10);
- Dd) a, b, c
1414. What will be the result? int i=5; int j=1; int x=(j--)+(--i);
- Aa) x=6;
- Bb) x=5;
- Cc) x=7;
- Dd) x=8;
1515. What will be the result? int x=10,i=0,j=2; x+=(i-j);
- Aa) 14
- Bb) 12
- Cc) 10
- Dd) 8
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
1722. 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
1823. C# classes contain:
- Aa) properties and functions
- Bb) data members(field, variables), properties and methods
- Cc) method, functions and constructors
- Dd) variables and methods
1924. The properties in C# classes are…
- Aa) procedures and functions
- Bb) constructors
- Cc) data members(variables)
- Dd) members with get and set
2025. C# procedure specifies with …
- Aa) this keyword
- Bb) void keyword
- Cc) return data type
- Dd) static keyword
2126. An object is …
- Aa) a property of the class
- Bb) an instance of the class
- Cc) a method of the class
- Dd) a data member of the class
2228. Access modifiers are ...
- Aa) void and return data types
- Bb) public and private
- Cc) data types
- Dd) this and static keywords
2329. A public method with the same name as the class with no return type is ...
- Aa) constructor
- Bb) function
- Cc) procedure
- Dd) property
2437. The default constructor is a method with …
- Aa) any arguments
- Bb) no arguments
2540. The “this” keyword can be used for...
- Aa) methods
- Bb) functions and procedures
- Cc) constructors
- Dd) a, b, c
2641. Choose the correct declaration of array.
- Aa) int[] a = int[10];
- Bb) int[] c = new int[10];
- Cc) int[] a = new [10];
- Dd) a, b, c
2742. Choose the correct declaration of jugged array.
- Aa) int [][] j = new int[];
- Bb) int [][] j = new int[][5];
- Cc) int [][] j = int [5][5];
- Dd) int [][] j = new int[5][];
2843. Choose the correct declaration and initialization of array.
- Aa) int[] a = new int[5]{1,5,8,4,5};
- Bb) int[] a = {1,5,8,4,5};
- Cc) a,b
- Dd) there is no correct answer
2944. Choose the correct declaration of two-dimensional array.
- Aa) int[][] a = new int [2][5];
- Bb) int [] a = new int [2][5];
- Cc) int [,] a = new int[2,5];
- Dd) int[,] a = new int[2][5];
3045. The last unit (element) index of array is…
- Aa) 0
- Bb) 10
- Cc) length
- Dd) length-1
3146. How many elements does the next array include? Int[] a=new int[77];
- Aa) 76
- Bb) 77
- Cc) 78
3247. How many elements does the next array include? Int[] a=new int[100];
- Aa) 99
- Bb) 100
- Cc) 101
3348. C# function specifies with …
- Aa) this keyword
- Bb) void keyword
- Cc) return data type
- Dd) static keyword
3451. Choose the correct assignment? int i,j;
- Aa) i,j=8;
- Bb) i=8,j=8;
- Cc) i=(j=8);
- Dd) a,b,c;
3556. How many elements does the next array include? int[] a=new int[99];
- Aa) 99
- Bb) 100
- Cc) 101
3657. Choose the core principles of OOP
- Aa) Encapsulation and Inheritance
- Bb) Encapsulation, Inheritance and Polymorphism
- Cc) encapsulation and polymorphism
- Dd) encapsulation, inheritance, polymorphism, aggregation and composition
3758. Hiding an object’s internal implementation detail is…
- Aa) encapsulation
- Bb) inheritance
- Cc) polymorphism
- Dd) composition
3859. Which concept promotes code reuse?
- Aa) encapsulation
- Bb) inheritance
- Cc) polymorphism
- Dd) composition
3960. Which statement shows Encapsulation concept?
- Aa) string s = “Hello World!”;
- Bb) int a,b=0;
- Cc) b++;
- Dd) string s = “hello”, bool i=s.Equals(“!”);
4061. Closely related to the notion of encapsulating programming logic is the idea of…
- Aa) overriding
- Bb) data protection
- Cc) overloading
- Dd) realization
4162. Which access modificator (s) related to the data protection?
- Aa) public
- Bb) protected
- Cc) private
- Dd) private and protected
4263. Members of a class that represent an object’s state should not be marked as
- Aa) public
- Bb) private
- Cc) protected
4364. Choose traditional technique to encapsulate class’s data.
- Aa) Define default constructor
- Bb) Define your own constructor
- Cc) Define a pair of public accessor(get) and mutator(set) methods
- Dd) Mark the data of class as public
4465. Choose a technique to encapsulate class’s data
- Aa) Define fields of class
- Bb) Define your own constructor
- Cc) Define a public properties
- Dd) Define a private properties
4566. The “Black boxing programming” term is related to
- Aa) inheritance
- Bb) encapsulation
- Cc) objects
- Dd) polymorphism
4667. A “get” method …
- Aa) returns the current value of state data
- Bb) returns the default value of state data
- Cc) allows to change the current value of state data
- Dd) allows to change the methods of class
4768. A “set” method …
- Aa) returns the current value of state data
- Bb) returns the default value of state data
- Cc) allows to change the current value of state data
- Dd) allows to change the methods of class
4869. Is it possible to perform any internal logic necessary before making the value assignment in properties
of class?- Aa) yes
- Bb) no
4970. Which keyword is related to the "get" block of property?
- Aa) value
- Bb) return
- Cc) this
- Dd) public
5071. Which keyword is related to the "set" block of property?
- Aa) value
- Bb) return
- Cc) this
- Dd) public
Información
- Descripción
- Test sobre Sin título, creado por YouTube Channel el 22/01/2017.
- Autor
- YouTube Channel
- Idioma
- English
- Visitas
- 8
- Historial
- Creado el 22 ene 2017 · actualizado el 22 ene 2017
- Valoración
- Aún sin valoraciones Valora este test