Login
Register
@
Dark Mode
Profile
Edit my Profile
Messages
My favorites
Register
Activity
Q&A
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous Years
Blogs
New Blog
Exams
Dark Mode
Consider the following class definitions in a hypothetical Object Oriented language that supports inheritance and uses dynamic binding. The language should not be assumed to be either Java or C++, though the syntax is similar. Class P { void f(int i) { print(i); } } Class Q subclass of P { void f(int i) { print(2*i); } } Now consider the following program fragment: P x = new Q(); Q y = new Q(); P z = new Q(); x.f(1); ((P)y).f(1); z.f(1); Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be (A) 1 2 1 (B) 2 1 1 (C) 2 1 2 (D) 2 2 2
Jeetmoni saikia
asked
in
Programming
Oct 10, 2022
retagged
Oct 11, 2022
by
makhdoom ghaya
268
views
0
votes
0
votes
programming
object-oriented-programming
Jeetmoni saikia
asked
in
Programming
Oct 10, 2022
retagged
Oct 11, 2022
by
makhdoom ghaya
by
Jeetmoni saikia
268
views
answer
comment
Follow
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
0
Answers
← Previous
Next →
← Previous in category
Next in category →
Related questions
0
votes
0
votes
0
answers
1
Jeetmoni saikia
asked
in
Programming
Oct 16, 2022
158
views
Class P { void f(int i) { print(i); } } Class Q subclass of P { void f(int i) { print(2*i); } } Now consider the following program fragment: P x = new Q(); Q y = new Q(); P z = new Q(); x.f(1); ((P)y).f(1); z.f(1); Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be (A) 1 2 1 (B) 2 1 1 (C) 2 1 2 (D) 2 2 2
Jeetmoni saikia
asked
in
Programming
Oct 16, 2022
by
Jeetmoni saikia
158
views
programming-in-c
output
normal
3
votes
3
votes
3
answers
2
Sahil Gupta
asked
in
Probability
Dec 12, 2014
2,277
views
The probability of solving a problem by three students X,Y,Z are 1/4,3/7and 2/9 respectively. if all of them try independently then the probability that the problem could not be solved is a)1/3 b)1/4 c)1/5 d) 2/5 e) 3/7
Sahil Gupta
asked
in
Probability
Dec 12, 2014
by
Sahil Gupta
2.3k
views
probability
0
votes
0
votes
0
answers
3
M.Zain
asked
in
Digital Logic
Dec 30, 2022
80
views
A sequential circuit has two D flip-flops, two inputs x and y, and one output Z is specified by the following next-state and output equations A(t+1) = xy’ + x B B(t+1) = xA +xB’ Z = A (a) Draw the logic diagram of the circuit. (b) List the state table for the sequential circuit. (c) Draw the corresponding state diagram.
M.Zain
asked
in
Digital Logic
Dec 30, 2022
by
M.Zain
80
views
digital-logic
sequential-circuit
output
0
votes
0
votes
1
answer
4
Baljeet Sohal
asked
in
Quantitative Aptitude
Jun 29, 2015
4,915
views
A shopkeeper makes a profit of q% by selling an object for RS 24 .had the c.p and s.p interchanged ,it would have led to a loss of 62.5q% .with the latter c.p ,what should be the new selling price to get a profit of q%?
Baljeet Sohal
asked
in
Quantitative Aptitude
Jun 29, 2015
by
Baljeet Sohal
4.9k
views
Subscribe to GATE CSE 2023 Test Series
Subscribe to GO Classes for GATE CSE 2023
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
-tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
From Rank 4200 to 64: My Journey to Success in GATE CSE Exam
What are the key things to focus on during the final 10-15 days before the GATE exam to improve performance?
All India GO Classes Mock test
NTA UGC NET JRF December 2022 Apply Online Form 2023
Life happens, just chill and do hardwork
Subjects
All categories
General Aptitude
(2.5k)
Engineering Mathematics
(9.3k)
Digital Logic
(3.3k)
Programming and DS
(5.8k)
Programming
(3.9k)
DS
(1.9k)
Algorithms
(4.6k)
Theory of Computation
(6.7k)
Compiler Design
(2.3k)
Operating System
(5.0k)
Databases
(4.6k)
CO and Architecture
(3.8k)
Computer Networks
(4.6k)
Non GATE
(1.3k)
Others
(2.4k)
Admissions
(649)
Exam Queries
(842)
Tier 1 Placement Questions
(17)
Job Queries
(74)
Projects
(9)
Unknown Category
(853)
Recent Blog Comments
AIMT is live now:...
It is at 9:30. Test Link will be available at...
@Deepak Poonia @Sachin Mittal 1 sir...
@mahendrapatel
Initially go classes planned on saturdays but...
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy