Warm-up Exercises

Questions

  1. Give two examples of instant messaging applications.

  2. How many bits are in one byte?

  3. Why are “ancient” programming languages like COBOL and FORTRAN still in use?

#: The least significant (rightmost) bit of even numbers in binary representation is 1. ________

#: Commands for managing the IDE and for developing, maintaining and executing programs are contained in the menus, which are located on the menu bar. ________

#: Is the following statement true: 010000 < 001111? ________

#: You can browse the web from within the Visual Studio Community environment. ________

#: Visual Studio Enterprise can be used to create apps only in C#. ________

#: High-level computer languages are easily understood by a computer without any need of translation. ________

#: An assembler converts assembly language programs into machine language. ________

#: Is the role of CPU to govern computing devices and processes? ________

#: Was Windows system developed in sixties? ________

#: Do console applications provide visual environment? ________

  1. Computers process data, using sets of instructions called …
  • specifications
  • computer programs
  • recipes
  • hardware
  1. ______ Law states that every year or two, the computing power of computers doubles without any increase in price.
  • Gate’s
  • Moore’s
  • Henderson’s
  • None of the above.
  1. The main purpose of the AUL unit is: ______.
  • to store permanent data
  • to store temporary data
  • to cool the computer down and prevent overheating
  • to perform calculations and logical comparisons for the computer
  1. Binary code is: ______.
  • a complex, but easy to use, modern programming language
  • a series of 0s and 1s
  • high-level machine language instructions
  • a series of characters representing the numbers 0 to 9
  1. The order of simplicity (easiest to hardest) to a human of the three basic types of languages is: ______.
  • high-level, assembly, machine
  • assembly, machine, high-level
  • machine, high-level, assembly
  • machine, assembly, high-level
  1. Which of the following is true: C# ______.
  • is object oriented
  • contains a powerful class library
  • is not limited to web-based applications
  • all of the above
  1. Visual C# programs are created using Microsoft’s Visual Studio–a collection of software tools called a(n) ______.
  • operating system
  • Integrated Programming Environment
  • Integrated Development Environment
  • Class Library
  1. The purpose of the Visual Studio Enterprise is to ______.
  • create a program
  • run a program
  • debug a program
  • all of the above
  1. This menu contains commands for opening projects, closing projects, printing project data, etc.
  • View menu
  • Edit menu
  • Tools menu
  • File menu
  1. A single line comment in C# begins with which double symbol?
  • **
  • //
  • ##
  • $$
  1. Which method is the starting point of any C# program?
  • Open
  • Main
  • Start
  • none of these.
  1. All statements in C# end with:
  • semicolon
  • colon
  • comma
  • full stop
  1. Violations of language rules are referred to as:
  • semantic errors
  • syntax errors
  • run-time errors
  • none of these
  1. What operator is used to denote remainder (modulo) operation?
  • &
  • %
  • #
  • @
  1. Which of the following is in highest-to-lowest order of operator precedence?
  • multiplication, division, parentheses
  • addition, subtraction, division
  • parentheses, multiplication, addition
  • none of these
  1. In C# code: Console.WriteLine($"Initial value is: {myAccount.GetNumber()}"); which method is called (executed) first?
  • WriteLine()
  • GetNumber()
  • they are called at the same time
  • none of these
  1. Which of these are binary operators?
  • / (division)
  • * (multiplication)
  • + (addition)
  • all of these
  1. You can declare the same variable twice in a C# code.
  • Yes
  • No
  1. It is good to initialize all variables upon their creation (declaration).
  • Yes
  • No
  1. Is = the equality operator in C#?
  • Yes
  • No
  1. Visual C# programs are created using Microsoft’s Visual Studio—a collection of software tools called a(n) _____.
  • Operating system
  • Integrated Programming Environment
  • Integrated Development Environment
  • Class Library.
  1. The starting point of a C# application is the
  • Main
  • Start
  • Open
  • None of the above.
  1. C# statements in C# usually end with:
  • :
  • ;
  • #
  • .
  1. _____ are violations of language rules.
  • Logic errors
  • Syntax errors
  • Run-time errors
  • None of the above.
  1. A variable is:
  • An instruction for the compiler
  • A location in memory where a value is stored
  • A description of a method call (including the argument list)
  • None of the above.
  1. What is an algorithm?
  • The actions (and their order) that solve a particular problem
  • An English description of a problem to be solved
  • The declaration of an object.
  • None of the above.
  1. The order of simplicity (easiest to hardest) to a human of the three basic types of languages is:
  • High-level, machine, assembly
  • Machine, high-level, assembly
  • Assembly, machine, high-level
  • High-level, assembly, machine.
  1. Which of these are binary operators?
  • * (multiplication)
  • + (addition/concatenation)
  • / (division)
  • All of these.
  1. What is the correct order of actions in developing software?
  • Define the problem, develop an algorithm, code a C# program, run tests
  • Code a C# program, develop an algorithm, run tests
  • Code a C# program, run tests, develop an algorithm.
  • Define the problem, run tests, code a C# program.
  1. What is the resulting value of c at the end of the following code segment?
int c = 5;
c *= --c;
  • 25
  • 15
  • 20
  • None of the above
  1. What value will be printed on the output:
int A = 16; int B = 3;
Console.WriteLine(A/B);
  • 1
  • 5.33
  • -1
  • 5
  1. Some compilers will automatically remove body statements from loops that do not need to be executed multiple times through a process known as _____.
  • Classification
  • Optimization
  • Interpretation
  • None of the above.

Problems

  1. Find 3 syntax errors in this short C# code.
int num11 =1;
int num2 ==2;
if num11>-num2) {Console.WriteLine(“Yes”);}
else {Console.WriteLie(“No”);} 
  1. What sequence will appear on the output of this C# code? Which parameter of SD(int[] A, int B) method is passed by value?

    using System;
    class Program
    {
        static void SD(int[] A, int B)
        {
            A[2] += A[2];
            B /= B;
        }
        static void Main(string[] args)
        {
            int[] A = { 0, 1, 2, 3 };
            S(A, A[2]);
            Console.Write($"[{A[0]},{A[1]},{A[2]},{A[3]}]");
        }
    }
  2. Consider the following code:

for (int y = 1; y <= 3; y++)
{
    for (int z = 1; z < 5; z++)
        Console.Write("Scene " + y + ", take " + z + ". " );
    Console.WriteLine();
}
  • How many times does the outer loop iterate (i.e., how many scenes are shot)?
  • How many times does the inner loop iterates (i.e., how many takes for each scene)?
  • Finally, what is the total number of iteration of the nested loops (i.e., how many takes are made, total)?
  1. Mark the pretest loops:

    • do while
    • switch
    • while
    • for
    • if-else-if
  2. Which of the following correctly declares and creates a two-dimensional rectangular array of integers?

    • int[,] sum = new int[10, 40];
    • int[][] sum = new int[25, 43];
    • int sum[] = new int[20, 20];
    • None of the above.
  3. C# supports two types of two-dimensional arrays:

    • quadrilateral and isosceles
    • jagged and rectangular
    • jagged and round
    • None of the above.