rummanansari Template
  • Home
  • Blog
    • Blog - HOME
    •   Technical
    • Search Engine Optimization
    • Data Structure
    • Image Processing
    • C Programming
    • .NET
    • SQL Server
    • TCS Preparation
    • Miscellaneous
    •   Non Technical
    • Top 10
    • Life Lesson
    •   Quotes
    • English Quotes
    • Bangla Quotes
    • Bangla to English Translations
    • Bangla Kobita
    • Bangla Whatsapp Story
  • Topics
    • GK - HOME
    • Basic GK
    • General Science
    • Honours and Awards
    • Inventions
    • World Organisations
    • Important Days
    • World Geography
    • Indian Geography
    • Indian History
    • Computer Awareness
    • MS excel, office etc.
    • Problems on Train
    • more...
  • Course
    • Library Home
    • AJAX
    • AngularJS
    • Arithmetic Aptitude
    • Artificial intelligence
    • Automata Theory
    • AZ-400: Designing and Implementing Microsoft DevOps Solutions
    • Azure DevOps for Beginners
    • Bangla to English
    • Biography
    • Biology
    • Bootstrap 4
    • C Programming Language
    • C Programming Language Video Bangla
    • C# Programming Language
    • C++ language
    • Competitive Exam
    • Computer Awareness Video
    • Computer Fundamentals
    • Computer Network
    • Computer Science and Engineering
    • Continuous Deployment
    • Continuous Integration
    • CSS
    • Current Affairs
    • Data Structure
    • Database Management System
    • Digital Logic
    • Education
    • Electrical Engineering
    • English
    • English Grammar
    • General Aptitude
    • Geography
    • History
    • HTML 5
    • Important Days and Dates
    • Interview Questions
    • ISC - COMPUTER SCIENCE - XI
    • Islam
    • Java Programming Language
    • JavaScript
    • Leadership behavior and Culture
    • Logical Fallacy
    • Machine Learning
    • Mastering HTML: From Fundamentals to Advanced Concepts
    • Mastering JavaScript: From Fundamentals to Advanced Concepts
    • Mathematics
    • Mathematics for Programming
    • Mathematics in Bangla - Class 5
    • MB-310: Microsoft Certified: Dynamics 365 Finance Functional Consultant Associate
    • MB-330: Microsoft Certified: Dynamics 365 Supply Chain Management Functional Consultant Associate
    • MB-700: Microsoft Dynamics 365: Finance and Operations Apps Solution Architect
    • MB-920: Microsoft Dynamics 365 Fundamentals (ERP)
    • Microservices Architecture
    • Microsoft Azure
    • Microsoft Excel - Bangla
    • Mindwork games
    • Miscellaneous Topics
    • Misconceptions about Islam
    • MySQL
    • Neural Networks and Deep Learning
    • NPM - Package Manager
    • Pakistan Geography
    • Photoshop
    • PHP
    • Programming Language
    • Prompt Engineering
    • Puzzles
    • Python
    • R Programming Language
    • ReactJS
    • Science
    • Social Science
    • SQL
    • SQLite
    • Tamil Nadu State board (Class 10)
    • Technical MCQs
    • Technical Short Answers
    • TypeScript - JavaScript's Superset
    • UGC NET, SET
    • User Experience
    • Verbal and Reasoning
    • Vue JS
    • অতীত ও ঐতিহ্য: অষ্টম শ্রেণীর: পশ্চিমবঙ্গ মধ্যশিক্ষা পর্ষদ
    • অর্থনীতি
    • আরবী ভাষা কোর্স - Diploma in Arabic language
    • ইতিহাস
    • ইতিহাস ও পরিবেশ: দশম শ্রেণি: পশ্চিমবঙ্গ মধ্যশিক্ষা পর্ষদ
    • ইসলামিক বই
    • ইসলামে আকীকা
    • ইসলামে নারী
    • এসো আরবী শিখি
    • কুরআন
    • জীবনবিজ্ঞান ও পরিবেশ (দশম)
    • তাহারাত কুইজ প্রতিযোগিতা
    • নবীদের কাহিনী - The story of the prophets
    • পরিবেশ ও বিজ্ঞান
    • প্যারেন্টিং - Parenting
    • প্রচলিত ভুল বিষয়ে প্রতিযোগিতা টেস্ট কুইজ
    • প্রশ্নোত্তরে ইসলামী জ্ঞান
    • বাংলা ইসলামিক কুইজ - Bangla Islamic Quiz
    • বাংলা সাহিত্য
    • ব্যক্তিগত উন্নয়ন (Personal Development)
    • ভূগোল
    • মডার্ন কম্পিউটার অ্যাপ্লিকেশন - একাদশ শ্রেণী
    • মডার্ন কম্পিউটার অ্যাপ্লিকেশন - দ্বাদশ শ্রেণী
    • লেখক এবং কবি
    • শয়তান পরিচিতি
    • সংক্ষিপ্ত জীবনী
    • সাধারণ জ্ঞান
    • সাহাবীদের জীবনী
    • সীরাত প্রতিযোগিতার প্রশ্ন ও উত্তরসমূহ
  • Paid Courses
    • Library Home
    • X++ Programming Language
    • X++ Programming Fundamentals - D365 F&O Technical
    • D365 F&O MCQ Questions - X++ Programming Language MCQ
    • ICSE Computer Applications Class 10 – Previous Year Question Papers & Solutions
    • GH-300: GitHub Copilot
    • Java Fundamentals: Building Strong Foundations
    • MB-500: Microsoft Dynamics 365: Finance and Operations Apps Developer
    • Authentication
    • Digital Productivity
  •  Login
    • Login - Dashboard
    • Login - Here
    • About Our Team
    • Privacy Policy
    • Terms and Conditions
    • Cancellation and Refund Policy
    • Shipping and Delivery Policy
    • Guest Post Rule
    • Contact Us
Menu

Login and Register

Go to Dashboard Logged In Successfully!


Check your Email for the OTP


  • Login
  • Registration
  • Forget Password



Assignment Operators - Quiz

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

What is the type of the below assignment expression if x is of type float, y is of type int? y = x + y;

  • Aint
  • Bfloat
  • C double
  • DThere is no type for an assignment expression

Which operator is used for assignment in Java?

  • A =
  • B ==
  • C :=
  • D =>

What is the value of x after the expression x = 10 is executed in Java?

  • A 0
  • B 5
  • C 10
  • D 15

What is the value of p after the expression p /= 2 is executed in Java?

  • A 0
  • B 1
  • C 2
  • D 4

If x is 6 and y is 2, what is the value of the expression x %= y using the compound assignment operator in Java?

  • A 0
  • B 1
  • C 2
  • D 3

What is the value of the expression a <<= 2 using the compound assignment operator in Java? a = 5

  • A 0
  • B 20
  • C 8
  • D 4

If b is 3 and c is 2, what is the result of the expression b >>= c using the compound assignment operator in Java?

  • A 0
  • B 1
  • C 2
  • D 3

What is the value of m &= 5 after the expression is executed in Java? (m = 10)

  • A 0
  • B 1
  • C 5
  • D 10

What will be the output of this code

class PostAndPre
{
	public static void main( String args[])
	{
		int a = 2;
		int b = a++ - a++;
		System.out.println(b);
		System.out.println(a);
	}

}

  • A1
    2
  • B-1
    4
  • C0
    4
  • D1
    3

What will be the output of this code

class PostAndPre
{
	public static void main( String args[])
	{
		int a = 2;
		int b = a++ - a++;
		System.out.println(b);
		System.out.println(a);
	}

}

  • A1 2
  • B-1 4
  • C0 4
  • D1 3
Results:
🟢 Correct Answers:   🔴 Wrong Answers:

💹 View Detailed Quiz Results

🛫 Take Another Quiz
Login to save results
Quiz Information
Quiz Information

Quiz Platform FAQ

General Information

  • Number of Questions: Each quiz consists of 10 questions.
  • Time Limit: You have 30 seconds per question. The total time to complete the quiz is 5 minutes.
  • Multiple Attempts: You can take the quiz multiple times to improve your score.

Results and Feedback

  • Result Analysis: After completing the quiz, you will see a results page with the following details:
    • Correct Option for each question.
    • Your Selected Option for each question.
    • Explanation for each answer to help you understand why it is correct or incorrect.
    • Percentage of Correct Answers to show your overall performance.
  • Interactive Features: The platform provides feedback on each attempt to help you learn and improve.

Important Instructions

  • Do Not Refresh: Do not refresh the page while taking the quiz. Refreshing the page will end the current quiz and a new quiz will start.
  • Saving Your Quiz: To save your quiz progress and questions, log in to your account. Once logged in, you can view saved quizzes in your profile section.
  • Mandatory Selection: All questions are mandatory to select. If you do not select all 10 questions, you will not be able to submit the quiz. Once all questions are selected, you will be able to see the Submit button. If you wait until the end of the time, the quiz will be auto-submitted by the system, and you will be able to see your results.

Tips for Taking the Quiz

  • Manage Your Time: Keep track of the time for each question to ensure you have enough time to answer all 10 questions.
  • Review Explanations: After the quiz, read the explanations provided for each answer to enhance your understanding of the material.
  • Retake the Quiz: If desired, take the quiz again to improve your score and reinforce your learning.
  • Avoid Refreshing: To prevent losing progress, avoid refreshing the page during the quiz.
  • Log In to Save: If you want to save your quiz progress, log in to your account and check your profile section for saved quizzes.
Quiz Analytics

Assignment Operators - Quiz

Guest User clock Time Taken:
Questions: Answered: Not Answered:
rightCorrect Answer: wrongWrong Answer: percentage smallPercentage: %

Q: What is the type of the below assignment expression if x is of type float, y is of type int? y = x + y;

  • A. int
  • B. float
  • C. double
  • D. There is no type for an assignment expression
Correct Option: A
Remarks:

Explanation: Option A

Q: Which operator is used for assignment in Java?

  • A. =
  • B. ==
  • C. :=
  • D. =>
Correct Option: A
Remarks:

Explanation:

The assignment operator (=) in Java is used to assign a value to a variable. It takes the value on the right-hand side and assigns it to the variable on the left-hand side.

The assignment operator in Java is =. Here's an example:


public class AssignmentExample {
    public static void main(String[] args) {
        // Assigning value to a variable
        int number = 42;

        // Displaying the value
        System.out.println("The value of number is: " + number);
    }
}

In this example, the value 42 is assigned to the variable number using the assignment operator (=). When you run this Java program, it will output "The value of number is: 42".

Q: What is the value of x after the expression x = 10 is executed in Java?

  • A. 0
  • B. 5
  • C. 10
  • D. 15
Correct Option: C
Remarks:

Explanation:

The assignment operator (=) in Java is used to assign a value to a variable. In this case, x = 10 assigns the value 10 to the variable x.


public class AssignmentExample {
    public static void main(String[] args) {
        // Declare a variable
        int x;

        // Assign a value to the variable
        x = 10;

        // Display the value of x
        System.out.println("The value of x is: " + x);
    }
}

When you run this Java program, it will output "The value of x is: 10". This demonstrates the assignment of the value 10 to the variable x.

Q: What is the value of p after the expression p /= 2 is executed in Java?

  • A. 0
  • B. 1
  • C. 2
  • D. 4
Correct Option: B
Remarks:

Explanation:

In Java, the expression p /= 2 is a compound assignment operator, which divides the value of p by 2 and assigns the result back to p. It is equivalent to the expression p = p / 2.

If p is initially some numeric value, the result of the expression p /= 2 would be:


p = p / 2;

Here's an example in Java:


public class CompoundAssignmentExample {
    public static void main(String[] args) {
        // Declare variable
        double p = 10.0;

        // Compound assignment
        p /= 2;

        // Display the result
        System.out.println("The value of p after p /= 2 is: " + p);
    }
}

In this example, if p is initially 10.0, after the operation, the value of p will be 5.0 (10.0 / 2).

Q: If x is 6 and y is 2, what is the value of the expression x %= y using the compound assignment operator in Java?

  • A. 0
  • B. 1
  • C. 2
  • D. 3
Correct Option: B
Remarks:

Explanation:

In Java, the expression x %= y is a compound assignment operator, which calculates the remainder of the division of x by y and assigns the result back to x. It is equivalent to the expression x = x % y.

If x is initially some numeric value and y is another numeric value, the result of the expression x %= y would be:


x = x % y;

Here's an example in Java:


public class CompoundAssignmentExample {
    public static void main(String[] args) {
        // Declare variables
        int x = 6;
        int y = 2;

        // Compound assignment
        x %= y;

        // Display the result
        System.out.println("The value of x after x %= y is: " + x);
    }
}

In this example, if x is initially 6 and y is 2, after the operation, the value of x will be 0 (the remainder of 6 divided by 2).

Q: What is the value of the expression a <<= 2 using the compound assignment operator in Java? a = 5

  • A. 0
  • B. 20
  • C. 8
  • D. 4
Correct Option: B
Remarks:

Explanation:

In Java, the expression a <<= 2 is a compound assignment operator that performs a left shift on the variable a by the number of bits specified on the right side of the <<= operator. It is equivalent to the expression a = a << 2.

Here's an example in Java:


public class CompoundAssignmentExample {
    public static void main(String[] args) {
        // Declare variables
        int a = 5;

        // Compound assignment (left shift by 2 bits)
        a <<= 2;

        // Display the result
        System.out.println("The value of a after a <<= 2 is: " + a);
    }
}

In this example, if a is initially 5, after the operation, the value of a will be 20. This is because the binary representation of 5 is 0000 0101, and left-shifting it by 2 bits results in 0001 0100, which is 20 in decimal.

Q: If b is 3 and c is 2, what is the result of the expression b >>= c using the compound assignment operator in Java?

  • A. 0
  • B. 1
  • C. 2
  • D. 3
Correct Option: D
Remarks:

Explanation:

In Java, the expression b >>= c is a compound assignment operator that performs a right shift on the variable b by the number of bits specified on the right side of the >>= operator. It is equivalent to the expression b = b >> c.

Here's an example in Java:


public class CompoundAssignmentExample {
    public static void main(String[] args) {
        // Declare variables
        int b = 12;
        int c = 2;

        // Compound assignment (right shift by 2 bits)
        b >>= c;

        // Display the result
        System.out.println("The value of b after b >>= c is: " + b);
    }
}

In this example, if b is initially 12, after the operation, the value of b will be 3. This is because the binary representation of 12 is 1100, and right-shifting it by 2 bits results in 0011, which is 3 in decimal.

Q: What is the value of m &= 5 after the expression is executed in Java? (m = 10)

  • A. 0
  • B. 1
  • C. 5
  • D. 10
Correct Option: A
Remarks:

Explanation:

In Java, the expression m &= 5 is a compound assignment operator that performs a bitwise AND between the variable m and the value 5. It is equivalent to the expression m = m & 5.

Here's an example in Java:


public class CompoundAssignmentExample {
    public static void main(String[] args) {
        // Declare variables
        int m = 10;

        // Compound assignment (bitwise AND with 5)
        m &= 5;

        // Display the result
        System.out.println("The value of m after m &= 5 is: " + m);
    }
}

In this example, if m is initially 10, after the operation, the value of m will be 0. This is because the binary representation of 10 is 1010, and performing a bitwise AND with 5 (binary 0101) results in 0000, which is 0 in decimal.

Q: What will be the output of this code


class PostAndPre
{
	public static void main( String args[])
	{
		int a = 2;
		int b = a++ - a++;
		System.out.println(b);
		System.out.println(a);
	}

}

  • A. 1<br>2
  • B. -1<br>4
  • C. 0<br>4
  • D. 1<br>3
Correct Option: B
Remarks:

Explanation:

class PostAndPre
{
	public static void main( String args[])
	{
		int a = 2;
		int b = a++ - a++;
		System.out.println(b);
		System.out.println(a);
	}

}

Q: What will be the output of this code


class PostAndPre
{
	public static void main( String args[])
	{
		int a = 2;
		int b = a++ - a++;
		System.out.println(b);
		System.out.println(a);
	}

}

  • A. 1 2
  • B. -1 4
  • C. 0 4
  • D. 1 3
Correct Option: B
Remarks:

Explanation:

class PostAndPre
{
	public static void main( String args[])
	{
		int a = 2;
		int b = a++ - a++;
		System.out.println(b);
		System.out.println(a);
	}

}

Useful Links

  • Home
  • About us
  • Terms of service
  • Guest Post
  • Advertisement

Login

  • login
  • Sign Up

Visit All Home

  • Syllabus
  • Subject
  • Library
  • GK/MCQ
  • Blog

Social Links

  • Join Whatsapp Group
  • Join Telegram Group
© Copyright rummanansari. All Rights Reserved
Designed by rummanansari.com

You have unsaved changes or are in the middle of a quiz. If you leave, your progress might be lost. Select option for all questions.