Principles of Programming

A sleek digital illustration of a programming interface with code snippets and algorithm visuals, blending elements of education and technology, vibrant colors, engaging visuals.

Test Your Programming Principles Knowledge!

Welcome to our Principles of Programming quiz! This engaging quiz is designed to test your understanding of fundamental programming concepts, terminology, and best practices.

Whether you are a student looking to reinforce your coding knowledge or a teacher seeking a fun way to assess your students, this quiz offers:

  • 25 thought-provoking questions
  • A mix of multiple-choice and checkbox answers
  • A time-efficient way to gauge your programming prowess
25 Questions6 MinutesCreated by CodingEagle43
Which one of the following will declare an array and initialize it with five numbers?
A. Array a = new Array(5);
B. int [] a = {23,22,21,20,19};
C. Int a [] = new int[5];
D. int [5] array;

What is the value of ‘number’ after the following code fragment execution?

public static void main(String[] args) {

int number = 0;

int number2 = 12;

while (number < number2)

{

number = number + 1;

System.out.println(number);

}

}

Select one:

A. 123456789101112
B. 13
C. 12
D. 11

Which of the following options is the correct declaration of an integer type variable called numberOfMonths to which the value of is assigned? 

Select one or more:

A. Int numberOfMonths; numberOfMonths = 6;
B. Int numberOfMonths = 6;
C. int(numberOfMonths)= 6;
D. numberOfMonths(int) = 6;
Which three are legal array declarations?
1. int [] myScores [];
2. char [] myChars;
3. int [6] myScores;
4. Dog myDogs [];
5. Dog myDogs [7];

Which of the following statements are accurate? 

Select one or more:

A. Algorithmic thinking is the process where step-by-step instructions to solve a real world problem are identified.
B. Critical thinking complements computational thinking.
C. Decomposition is the process of breaking down a large problem in to smaller, more manageable chunks.
D. Pattern recognition is the process of identifying general attributes associated of real world objects.

What is an assignment statement?

Select one:

A. Assigning a value to a variable.
B. Adding a number to an int.
C. Assigning a name to a variable.
D. Assigning a multiplication.
Which is valid declaration of a float?
 
A. Float f = 1F;
B. Float f = 1.0;
C. Float f = "1";
D. Float f = 1.0d;
In terms of computational thinking, how can abstraction best be described?
A. A detailed representation of all the characteristics of a real world object
B. The process of filtering out irrelevant characteristics
C. The process of filtering out irrelevant characteristics and behaviours
D. A diagramatic representation of the interaction between real world objects.

What is the correct declaration statement for a simple integer array of 6 elements?

 

*The actual correct answer is 'd', but the quiz says that 'c' is correct, which it isn't*

a. Int arrayname[6] = new int [arrayname];
b. Int arrayname[] = new int [6];
C. Int arrayname[] = int [6];
D. int[] arrayname = new int [6];

Which of the following are methods associated with the String class?

A). length()

B). toLowerCase()

C). equals()

D). to UpperCase()

Select one:

A. Options A and C
B. Options C and D
C. All of the above.
D. Options A, B and D

Which of the following statements are true? Tick all that apply. 

Select one or more:

A. A class is an abstract data type, or user-defined type
B. An object has an interface, determined by its class
C. Each object has its own memory, and is made up of other objects.

Why is String declared using a capital S in Java?  

Select one:

A. Because it is a text-based data type.
B. Because it is a method.
C. Because it is an attribute.
D. Because it is a class and not a primitive data type.

Which of the following is considered as a blue print that defines the variables and methods common to all of its objects of a specific kind?

  1. Object
    B. Class
    C. Method
    D. Real data types

Select one:

A. Option B
B. Option D
C. Option C
D. Option A

Which is a valid declarations of a String?

  1. String s1 = null;
  2. String s2 = 'null';
  3. String s3 = (String) 'abc';
  4. String s4 = (String) '\ufeed';

Select one:

A. Option D
B. Option A
C. Option B
D. Option C

What is the correct declaration of a variable to hold a person's name?

Select one:

A. Boolean my_name = "Cardiff Met";
B. String my_name "Cardiff Met";
C. String my_name = "Cardiff Met";
D. String my_name = "Cardiff Met";

Which three are legal array declarations?

  1. int [] myScores [];
  2. char [] myChars;
  3. int [6] myScores;
  4. Dog myDogs [];
  5. Dog myDogs [7];

Select one:

A. All of the above.
B. 2, 3 and 4
C. 1, 2 and 4
D. 2, 4 and 5

Which of these is not a feature of all loops?

Select one:

A. Initialization
B. The word while.
C. A test statement.
D. A loop body.

In a String type array (names) holding the names of students in a class, what will the following statement produce?

Catherine

Alexandra

Daniel

David

Angela

Simon

System.out.println(names.1);

Select one:

A. 'Simon'
B. 'Catherine'
C. 'Alexandra'
D. 'David'

What is a loop?

Select one:

A. A segment of code to be run a specified number of times.
B. A segment of code to be run only when contained within an if statement.
C. A segment of code to be run an infinite number of times.
d. A type of Applet.

Which of the following statements is true? 

Select one or more:

A. The method to get the length (number of elements) of an arraylist is length().
b. The method to get the length (number of elements) of an arraylist is size().
C. An array differs from an array in that an arraylist is static, whereas an array is resizable.
d. An arraylist differs from an array in that an array is static, whereas an arraylist is resizable.

Which of the following statements about the Java language is true?

 

  1. Both procedural and OOP are supported in Java.
  2. Java supports only procedural approach towards programming.
  3. Java supports only OOP approach.
  4. None of the above.

Select one:

A. Option D
B. Option B
C. Option C
D. Option A

What is the size of an integer variable? 

Select one:

A. 64 bit
B. 16 bit
C. 8 bit
D. 32 bit
What is the correct syntax for a for loop? Select one:
A. for{ code to be executed; }
B. for(initialiser ; test-expression ; updater){ code to be executed;
C. for{ code to be executed; } else (test expression);
D. for{ code to be executed; }

Algorithmic thinking is the process of....

Select one:

A. Focusing on the important information only, ignoring irrelevant detail
B. Identifying step by step processes in order to solve a real world problem.
C. The identification of patterns in a data set.
D. Breaking down a complex problem or system into smaller, more manageable parts

What will be the output of the program?

class Test

{

    public static void main(String [] args)

    {

        Test p = new Test();

        p.start();

    }

 

    void start()

    {

        boolean b1 = false;

        boolean b2 = fix(b1);

        System.out.println(b1 + " " + b2);

    }

 

    boolean fix(boolean b1)

    {

        b1 = true;

        return b1;

    }

}

Select one:

A. True true
B. False false
C. False true
D. True false
{"name":"Principles of Programming", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Welcome to our Principles of Programming quiz! This engaging quiz is designed to test your understanding of fundamental programming concepts, terminology, and best practices.Whether you are a student looking to reinforce your coding knowledge or a teacher seeking a fun way to assess your students, this quiz offers:25 thought-provoking questionsA mix of multiple-choice and checkbox answersA time-efficient way to gauge your programming prowess","img":"https:/images/course1.png"}
Powered by: Quiz Maker